以微时间存储出价 [英] Store bids in microtime
本文介绍了以微时间存储出价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何根据php codeigniter中服务器的本地时间来存储出价?
所以每次用户输入一个出价,php会使用微时间函数来存储它。
How would you store bids according to the local time of the server in php codeigniter? so every time the user enters a bid , the php would use a microtime function to store it?
function create($ user_bid){
function create($user_bid){
$this->db->set('bid', $user_bid);
$this->db->set('microtime'=>microtime(TRUE)));
$this->db->insert('products',array('microtime'=>microtime(true)));
$query= $this->db->insert('products');
$this->load->view('bidding');
}
}
推荐答案
假设有一个MySQL数据库,为什么不在你的数据库上只有一个TIMESTAMP列: http://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html ,并让MySQL为您填充
Assuming a MySQL database, why not simply have a TIMESTAMP column on your database: http://dev.mysql.com/doc/refman/5.6/en/timestamp-initialization.html and leave MySQL to populate it for you
这篇关于以微时间存储出价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文