note 38489 deleted from function.time by didou

From: Date: Wed, 24 Dec 2003 01:21:38 +0000
Subject: note 38489 deleted from function.time by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-62397@lists.php.net to get a copy of this message
Note Submitter: calego at calego dot cc ---- I am not sure exactly why, but for some reason the time() function did not operate properly when placed in an equation and then compared to the database. I had this code; <?php $expiry = time() - 900; mysql_query("DELETE FROM table WHERE refresh<=".$expiry); ?> This did not carry out the query properly. I did this to check it: die($expiry), and it returned nothing. The following fixed both the query and the die(). <?php $expiry = intval(time()) - 900; mysql_query("DELETE FROM table WHERE refresh<=".$expiry); ?> Beware when placing timestamps in queries.

« previous php.notes (#62397) next »