Forum Moderators: open
I'm trying to update a row so that the value of a cell (shown)is equal to the date difference between the timestamp in another cell (time)and the current time.
I'm using MySQL, and this is what I have, but it doesn't seem to work.
Any suggestions? Thanks.
mysql_query("UPDATE mytable SET shown=DATEDIFF(time,'".date("Y-m-d H:i:s")."') WHERE ip='$ip'");
I renamed time to first_shown incase time was a reserved variable.
mysql_query("UPDATE mytable SET shown=DATEDIFF(first_shown,'".date("Y-m-d H:i:s")."') WHERE ip='$ip'");
I saw something about CURRENT_DATE. Should I be using that instead of the clunky date expression above?
Thanks