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 Link to comment https://forums.phpfreaks.com/topic/37685-solved-update-timestamp/ 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'"; Link to comment https://forums.phpfreaks.com/topic/37685-solved-update-timestamp/#findComment-180240 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 Link to comment https://forums.phpfreaks.com/topic/37685-solved-update-timestamp/#findComment-180243 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'" Link to comment https://forums.phpfreaks.com/topic/37685-solved-update-timestamp/#findComment-180246 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. Link to comment https://forums.phpfreaks.com/topic/37685-solved-update-timestamp/#findComment-180250 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.