honkmaster Posted March 31, 2012 Share Posted March 31, 2012 Hi, i'm trying to change the status column in a table I have based on the last date updated column older than 10 days. This is the query I have so far <?php date_default_timezone_set('Europe/London'); $now = time(); mysql_connect(localhost,$dbusername,$dbpassword); @mysql_select_db($db_name) or die( "Unable to select database"); $query="UPDATE contacts SET status = 'New Prospect' WHERE status = 'Allocated' AND lastupdated < now('d,-10')"; $result=mysql_query($query); mysql_close(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/260062-help-with-date/ Share on other sites More sharing options...
NomadicJosh Posted March 31, 2012 Share Posted March 31, 2012 Your $now is a variable, but in your mysql syntax, you are missing the $, unless you are trying to use the MySQL function NOW(). If so this might work, but I am not certain NOW() - INTERVAL 10 DAYS. I am not sure if it should be DAY or DAYS, but you can play with it to see if it will work. Quote Link to comment https://forums.phpfreaks.com/topic/260062-help-with-date/#findComment-1332978 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.