$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);
$ data = array('next'=>“NOW()+ 5”,'interval'=> $ dom [“USER”] [0] [“STATUSES_COUNT”] [0] [“数据”],'好' => $ good,'tries'=> $ p->尝试+ 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.
在zend和mySQL上使用PHP向数据库插入内容。 “next”=>“NOW()”不会起作用。我可以把CURRENT_TIMESTAMP作为默认值,但我真正想要的是插入引用此时刻的时间戳,加上一些时间。
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?
我可以重写程序的某些部分来使用纯php日期(纯mySQL日期的instade)。不知道什么是最好的,或者我应该怎么做。你知道我怎么能让这个更新与mySQL一起工作吗?
1 个解决方案
#1
I solved it with the next statement, very usefull:
我用下一个语句解决了它,非常有用:
'next' => new Zend_Db_Expr('TIMESTAMPADD(MINUTE,1,NOW())'),
#1
I solved it with the next statement, very usefull:
我用下一个语句解决了它,非常有用:
'next' => new Zend_Db_Expr('TIMESTAMPADD(MINUTE,1,NOW())'),