Re: [PHP] Loop, array, life....

2002-04-03 Thread Gerard Samuel
Its always the simplest things... I moved the sql stuff for the news into the first while loop, and it seems good. Thanks for waking me up... Steve Cayford wrote: > On your first email you loop through all the news in the $newsfetch > resource. I think you need to then do a mysql_data_seek() c

Re: [PHP] Loop, array, life....

2002-04-03 Thread Steve Cayford
On your first email you loop through all the news in the $newsfetch resource. I think you need to then do a mysql_data_seek() call against that to reset it for the next time through the loop. Otherwise you'll just get a null result because you're already at the end of the data. -Steve On Wedn

Re: [PHP] Loop, array, life....

2002-04-03 Thread Christopher William Wesley
You only want to retrieve the news from your table once. So, pull pull this code: > $container[] = $message; > while (list($news, $date) = mysql_fetch_row($newsfetch)) { > $container[] = '' . $news . ''; > $container[] = ''; > } > $container[] = ''; outside of (before) this loop:

[PHP] Loop, array, life....

2002-04-03 Thread Gerard Samuel
(made a correction in sudo code) Ok, this one is breaking my back all day. First some sudo-code -> fuction email_to_user() { $sql = 'select distinct(email) from user'; $emailfetch = mysql_query($sql); $sql = 'select news, date from news order by sid desc limit 10'; $news

[PHP] Loop, array, life....

2002-04-03 Thread Gerard Samuel
Ok, this one is breaking my back all day. First some sudo-code -> fuction email_to_user() { $sql = 'select distinct(email) from user'; $emailfetch = mysql_query($sql); $sql = 'select news, date from news order by sid desc limit 10'; $newsfetch = mysql_query($sql); while