Im trying to add 12 seconds to a mysql datetime object via php.

My php code generates the following query: "UPDATE Stats SET Usage = 1970-01-01 00:00:12" however the query fails.

My php code is as follows:

public function UpdateTime($diffrence)
{
    $seconds = $diffrence / 1000;

    mysql_connect('localhost','user','pass') or die("Unable to select host");

    mysql_select_db('StatDB') or die("Unable to select database");

    $query  = "SELECT * FROM Stats";

    $result=mysql_query($query);

    $retVal = mysql_result($result,0,"Usage");

    $oldTime = new DateTime($retVal);

    $oldTime-&gt;modify('+'. $seconds .' seconds');

    $from = date("Y-m-d H:i:s", strtotime($oldTime-&gt;format('Y-m-d H:i:s')));

    $query2  = "UPDATE Stats SET Usage = $from";
    echo $query2;

    $result2=mysql_query($query2);

    mysql_close();
}


Does anyone how I can fix this?

Thanks


Question: ArcMap 10.1 How to make mass (in bulk) update by attribute value
Answer: You would select the rows which are NULL (sounds like you have done that) then simply run the calculate field tool.

Right Click the field you want to modify (while objects are selected)
   

Then input your value "newvalue"

NOTE: 1. if you don't have a selection this will work on "ALL" rows in your table!
2. Double quotes in this area on your text/date value. See esri help for examples of vba/python/string/number/codeblock options
3. Must begin edit session to run in FGDB.