niche Posted September 9, 2011 Share Posted September 9, 2011 How do I get the the timestamp in to the expire_ts column? This query doesn't produce any errors, but fails to update with the timestamp. echo $expire_ts says "2011-09-09 14:41:15". The expire_ts is formated as "timestamp" Code: $expire_ts = date('Y-m-d H:i:s',$expire); mysql_query("UPDATE cookie SET timestamp = TIMESTAMP(NOW()), period_in_sec = '.$expire.', expire_ts = TIMESTAMP(' . $expire_ts . ') WHERE id = " . $id) or die(mysql_error()); Link to comment Share on other sites More sharing options...
niche Posted September 9, 2011 Author Share Posted September 9, 2011 I changed this -expire_ts = TIMESTAMP(' . $expire_ts . ')to this -expire_ts = TIMESTAMP(' $expire_ts ')and I got the desired results, but how can that be? Why no concatenate in this situation? Link to comment Share on other sites More sharing options...
justsomeguy Posted September 9, 2011 Share Posted September 9, 2011 You're mixing up single and double quotes. The query string is surrounded by double quotes, not single quotes. The field value should be surrounded by single quotes, so that's why it works. The original wasn't concatenating, it was putting the dots before and after the value in the query. Link to comment Share on other sites More sharing options...
niche Posted September 9, 2011 Author Share Posted September 9, 2011 You're right. I was mixed-up. I just didn't know why. Thanks for the redirection justsomeguy. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.