Hey I managed to write a script to update the oldest row in a database that has a certain value inside of it.
this is my code:
$change_value = "SELECT dtime FROM news WHERE type=2 ORDER BY dtime LIMIT 1";
$getrow = mysql_query($change_value) or die(mysql_error());
$changerow = mysql_fetch_array($getrow) or die(mysql_error());
$time=$changerow['dtime'];
mysql_query("UPDATE `news` SET type='3' WHERE type=`2` AND dtime = `.$time.` LIMIT 1") or die(mysql_error());
For some reason its not working, Meaning its not updating the oldest row with the oldest date in dtime.
The dtime is formatted like this:
2011-03-15 23:56:17
Can someone show me the correct way to do this?
All of the table names, seem correct.