MadDawgX Posted February 8, 2007 Share Posted February 8, 2007 Hey there, I'm having some problems on updating a timestamp field (active) in my Table (users). Here's what I got: // QUERY - Get User Data $qUserData = "SELECT * FROM users WHERE name='$LogUsername'"; $rUserData = mysql_query($qUserData) or die('Query failed. ' . mysql_error()); // Get Data $LogId = mysql_result($rUserData,0,'id'); // QUERY - Update Last Active $qLastLog = "UPDATE users SET active=unix_timestamp() WHERE id='LogId'"; $rLastLog = mysql_query($qLastLog) or die('Query failed. ' . mysql_error()); It just doesn't work. A couple things: 1. $LogId is returing 1 which is correct. 2. Nothing is affected in the active field of the row with id of 1. - Thanx Quote Link to comment Share on other sites More sharing options...
trq Posted February 8, 2007 Share Posted February 8, 2007 $qLastLog = "UPDATE users SET active='".unix_timestamp()."' WHERE id='$LogId'"; Quote Link to comment Share on other sites More sharing options...
MadDawgX Posted February 8, 2007 Author Share Posted February 8, 2007 Didn't work. Isn't unix_timestamp() a MYSQL function. I got the error: Fatal error: Call to undefined function unix_timestamp() in *** on line 54 Quote Link to comment Share on other sites More sharing options...
trq Posted February 8, 2007 Share Posted February 8, 2007 Sorry, your right. $qLastLog = "UPDATE users SET active='unix_timestamp()' WHERE id='$LogId'" Quote Link to comment Share on other sites More sharing options...
MadDawgX Posted February 8, 2007 Author Share Posted February 8, 2007 Okay, unix_timestamp() didn't work but NOW() did. Thanx. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.