Problem with mysql_fetch_array after first loop...
| From: | Jeffrey Baumgartner | Date: | Thu, 03 Mar 2005 11:44:10 +0000 |
| Subject: | Problem with mysql_fetch_array after first loop... | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-38747@lists.php.net to get a copy of this message | ||
I've made a little programme that deletes expired records from database tables. The troublesome bit looks like this...
$query = "SELECT ic FROM ic_ic WHERE date <= CURDATE()";
$result = mysql_query($query) or die("Unable to get old campaigns because " . mysql_error());
while ($row = mysql_fetch_array($result)){
extract($row);
...delete records from tables where ic = ic
}
It works fine for the fitst value of $ic, but on the second time around I get an error message saying that line [starting with "while..."] is not a valid MySQL resource. This really puzzles me because it works one time around, but not after that.
$ic, incidentally, is a string originally generated from the timestamp (ie. getdate[0]) - could this be causing a problem?
Many thanks!
Jeffrey