RoyBaird
Posts: 115
|
| Posted: 06/08/2010, 6:46 AM |
|
Hi All,
I have tried every combination posted in this forum to update the "users" table with the current date when a user logs on.
I receive no errors or warnings, and I get no data either. I have changed the field type to varchar and used a literal, changed to date and used Now() and a literal. I just cannot get the update to work. ANY help will be appreciated very much.
if (CCGetUserID() > 0)
{
$db = new clsDBstaged();
$SQL = "UPDATE users Set date_last_login = NOW() WHERE user_id =".$db->ToSQL(CCGetUserID(),ccsInteger);
$db->query($SQL);
$db->close();
}
_________________
Roy |
 |
 |
datadoit
|
| Posted: 06/08/2010, 7:00 AM |
|
Echo your $SQL to the screen. That will tell you whether or not you're
even matching your if/then condition.
|
|
|
 |
icp4all
Posts: 37
|
| Posted: 06/17/2010, 9:41 PM |
|
just add something like this in the common.php (located in common files)
$SQL = "UPDATE USERTABLE Set last_login_date = NOW() WHERE user_id =".CCGetUserID();
$db->query($SQL);
bevor " return $Result;" in CCLoginUser - Funktion
USERTABLE is the Name of your Table
and be sure that your date format maches with the Serverformat
ps sry about my english, ist a long time since i left scool^^
|
 |
 |
MichaelMcDonald
Posts: 640
|
| Posted: 06/19/2010, 3:34 AM |
|
I have something similar to this which works.
So try placing custom code on the Login form After Execute Insert event:
$db = new DBconnectionname();
$SQL = "UPDATE USERTABLE Set last_login_date = NOW()" . " WHERE user_id = " . $db->ToSQL(CCGetSession("UserID"),ccsInteger);
$db->query($SQL);
$db->close();
_________________
Central Coast, NSW, Australia.
|
 |
 |
|