Search code examples
mysqlzend-frameworkzend-dbzend-db-table

Insert a time + n in mySQL using Zend_db_table!


$data = array ( 'next' => "NOW() + 5", 'interval' => $dom["USER"][0]["STATUSES_COUNT"][0]["data"], 'good' => $good, 'tries' => $p->tries + 1 ); $where = $service->getAdapter()->quoteInto('id = ?', $p->id);
$service->update($data, $where);

to insert something to a database using PHP on zend and mySQL. The "next" => "NOW()" wont work. I could put the CURRENT_TIMESTAMP as default value, but what i actually want is to insert the timestamp refering this moment, plus some time.

I could rewrite some parts of the program to use pure php dates(instade of pure mySQL dates). Dont know what is best, or what should i do. Do you know how i could make this update work with mySQL doing the timing?


Solution

  • I solved it with the next statement, very usefull:

    'next' => new Zend_Db_Expr('TIMESTAMPADD(MINUTE,1,NOW())'),