Page 1 of 1

foreach() error..

Posted: Tue Jun 12, 2007 5:16 am
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..

Posted: Tue Jun 12, 2007 5:25 am
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?

foreach() error..

Posted: Tue Jun 12, 2007 6:12 am
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..