joined:Apr 23, 2009
I am PHP and MySQL for a simple CRM type system and I have an audit database which tracks inserts, deletes, changes and so on.
In that database I capture the date of the event - whenever any signficant action occurs I use a variant of the below:
$company_id = $_SESSION['company_id'];
$username = $_SESSION['username'];
$user_ip = $_SERVER['REMOTE_ADDR'];
$datetime = date('Y-m-d H:i:s');
$action = "Updated company information";
$sql = mysql_query("INSERT INTO auditing values ('','$company_id','$username','$user_ip','$datetime','$action')");
The information is all entered but the time is entered as 60 minutes behind the correct time - I have checked the time on the server and it is correct and if I do something like this in PHP:
it also returns the correct date BUT as soon as I login it enters the datetime as 60 minutes behind the actual time. If I login at 22:58:13, it enters it as 21:58:14
I have looked through all my scripts and I am not modifying the date anywhere and I just cannot figure out why this is happening.
What am I overlooking? :(