Anyone ever have the experience of working on a site, working with MySQL and
then having something almost inexplicable happen?

I was working on a script, and had this weird event.  A very simple script
with this:

    or die("Query Connection Database failed");
mysql_query("DELETE FROM Users WHERE Date < $old");

$cartquery = mysql_query("SELECT CartItemsID,Date FROM CartItems")
        or die("Query failed");
$cartnow  = mysql_query($cartquery);
$cartme = mysql_num_rows($cartnow);  <<<<this is the line that is failing!
while ($cr < $cartme){
if ($DCHK < $old) {
mysql_query("DELETE FROM CartItems WHERE CartItemsID = '$CII'");

Started spitting this error at me:

Warning: Supplied argument is not a valid MySQL result resource in (exact
location snipped)

This is the line containing mysql_num_rows that is getting this error.

Someone please tell me I'm missing something obvious!  Yes, the connects to
MySQL database are fine.  I can run the query right in phpMyAdmin with no

If mysql_num_rows returns 0, or empty, it shouldn't be complaining, should
it?  It would just skip the loop, correct?



PHP General Mailing List (
To unsubscribe, visit:

Reply via email to