foreach() error..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
lamuk
Forum Newbie
Posts: 2
Joined: Tue Jun 12, 2007 5:01 am

foreach() error..

Post by lamuk »

hi, im having an error(Warning: Invalid argument supplied for foreach()) regarding foreach function. im a bit confused because it runs well on my localhost but not on the live web server.
please help me out how to fixed this. here is my code:

foreach ($data as $key => $row) {
$day[$key] = $row['day'];
$event[$key] = $row['what'];
}

thanks in advance..
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Hello.
What does

Code: Select all

echo '<pre>data: ', var_dump($data), "</pre>\n";

foreach ($data as $key => $row) {
  $day[$key] = $row['day'];
  $event[$key] = $row['what'];
}
print?
lamuk
Forum Newbie
Posts: 2
Joined: Tue Jun 12, 2007 5:01 am

foreach() error..

Post by lamuk »

oh.. yeah, you right.:lol: i miss looked that the array wasnt initialized properly coz the initillyzation triggers on the values in the URL string...

thanks.. just being pressured with the deadline :( .. i just got it fixed.. thanks again..
Post Reply