troubleshooting Question

Problem with a mysql query in running a cron

Avatar of dantana1776
dantana1776 asked on
PHPMySQL Server
3 Comments2 Solutions397 ViewsLast Modified:
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
glcummins

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros