"Jeffrey Baumgartner" <[EMAIL PROTECTED]> schreef in bericht
> 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?

Why don't you try it without using extract($row), and use $row[variable1]
$row[variable2] instead in your loops.
extract() pulls all the variables into the global namespace and can be quite
dangerous as it might overwrite other variables. (this might be whats
happening with the $result variable for example.
also, how does extract() behave when trying to convert the [0] [1] [2]
variables? you might be better off using mysql_fetch_assoc()

Best wishes,

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to