Wednesday, July 28, 2010

Re: Invalid argument supplied for foreach() , when i use sessions

cricket..thx for your help...the loop was empty as far as i could
tell...works now :)

i appreciate it.......

but i have sth else making me nuts.

when i echo data, it automatically makes a break with <p> and prints
the text into the next line...so my echo code is this in html:
<span class="data"><p>desc</p></span>

how can i make this <p> go away? cause my text wont appear where i
want it to be...i wanna print text without making a break

On 28 Jul., 20:03, cricket <zijn.digi...@gmail.com> wrote:
> On Wed, Jul 28, 2010 at 1:17 PM, Tomfox Wiranata
>
>
>
> <tomfox.wiran...@gmail.com> wrote:
> > hi everyone,
>
> > i write data in a session, which works perfectly well. but when i try
> > to loop through it with foreach the error appears
>
> > "Invalid argument supplied for foreach()"
>
> > i figured that only arrays can be looped. here is what i did:
>
> > filling the session:
>
> >        $input_title = $this->data['Linkable']['notes'];
> >        $this->Session->write('Linkable.title', $input_title);
>
> > setting:
> >        $this->set('linkables', $this->Session-
> >>read('Linkable.title'));
>
> > trying to echo data from my session in my view:
>
> > <?php
> >                foreach ($linkables as $linkable):
> >                endforeach;
> > ?>
>
> You have an empty loop there.
>
> > <span id="data"><?php echo $linkable['linkable.title']; ?></span>
>
> > what did i do wrong? i thought with $this->Session-
> >>write('Linkable.title', $input_title); i already created an array?
>
> What does debug($linkables) show?

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate