Jump to content

Recommended Posts

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();
?>

Link to comment
https://forums.phpfreaks.com/topic/260062-help-with-date/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/260062-help-with-date/#findComment-1332978
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.