I'm storing process time in a MySQL database as a float(4,4).
$start_time = microtime( TRUE );
// things happen in my script
$end_time = microtime( TRUE );
$process_time = $end_time - $start_time;
// insert $process time into mysql table
$process_time always displays correctly when outputted to the command line, but if it's value is greater than 1, it stores into mysql as .9999.
What gives?
解决方案
float(4,4) means total 4 digits, 4 of them are after the decimal point.
So you have to change to 10,4 for example
MySQL permits a nonstandard syntax: FLOAT(M,D) or REAL(M,D) or DOUBLE PRECISION(M,D). Here, “(M,D)” means than values can be stored with up to M digits in total, of which D digits may be after the decimal point.