Link to home
Start Free TrialLog in
Avatar of dantana1776
dantana1776

asked on

Problem with a mysql query in running a cron

I am trying to run a cron job whereby the expired items on my site will be cleaned up once they've reached their expiration date.  When I go to run the script that will execute this function I keep getting this message

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/school/public_html/cron.php on line 1069

Here is the code

$admin_old_items="select * from admin_settings where set_id=20";

$admin_old_res=mysql_query($admin_old_items);

$admin_old_row=mysql_fetch_array($admin_old_res);



$old="select * from placing_item_bid where (todays(now()) - todays(expire_date) ) >= ".$admin_old_row['set_value'];

$old_res=mysql_query($old);

while($old_row=mysql_fetch_array(old_res))

{

$del="delete  from placing_item_bid where item_id=".$old_row[item_id];

$del_sql=mysql_query($del);



$del="delete  from placing_bid_item where item_id=".$old_row[item_id];

$del_sql=mysql_query($del);

}  
 
The line in question on the error message is
while($old_row=mysql_fetch_array(old_res))

Any help in resolving this would be great.
ASKER CERTIFIED SOLUTION
Avatar of glcummins
glcummins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just a tip:

Follow every mysql_query with the following:

echo mysql_error();

If there is no error, nothing will be echoed out, but if there is, you will see what the real error message is :))