Bug #1541 INSERT with NOW() is ~80% true
Submitted: 13 Oct 2003 9:01 Modified: 13 Oct 2003 14:04
Reporter: [ name withheld ] Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.15 OS:Linux (Linux 2.4.21 (MD9.1))
Assigned to: CPU Architecture:Any

[13 Oct 2003 9:01] [ name withheld ]
Description:
It seems NOW() isn't consequent. 80% of the Lastvisit=NOW() is correct - the other 20% is just blank DATETIME fields ('0000-00 etc' because it's default).

# 80% prob Lastvisit will be =NOW()
$sql='INSERT INTO sessions (SessionID,Mobilenumber,OperatorsID,LanguagesID,Lastvisit) '.'VALUES '.'("'.$ses_id.'","'.$originator.'","'.$operator.'","'.$lang.'",NOW())';
mysql_query($sql);

# This makes sure Lastvisit IS NOW()
$sql='UPDATE sessions SET Lastvisit=NOW() WHERE SessionID="'.$ses_id.'"';
mysql_query($sql);

How to repeat:
1) Create table with datetime
2) Make a php file which sets a column=NOW()
3) Repeat 2 many times
[13 Oct 2003 14:04] Alexander Keremidarski
Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.mysql.com/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to 'Open'.

Thank you for your interest in MySQL.

Please provide repeatable test case.

Send us sequence of SQL statements which can demonstrate the problem not PHP code.

This is in order to eliminate possible influence of client part (PHP engine in your case)

You can get sequence of queries as they are actually sent to MySQL by turining on general log and take them from there.