【发布时间】:2024-01-16 23:50:02
【问题描述】:
这是我的 CodeIgniter 模型中的 Database_update_entry 函数,它会在表单提交成功后执行。
<?php
function update_entry(){
$data = array(
'sl' => $this->input->post('item_sl'),
'item_name' => $this->input->post('item_name'),
'img_url' => $this->input->post('img_url'),
'sound_url' => $this->input->post('sound_url'),
'price' => $this->input->post('price'),
'unit' => $this->input->post('unit'),
'timestamp' => time(),
);
echo "current time: ". time();
$this->db->update(MY_TABLE_NAME, $data);
}
?>
数据库查询执行良好....但是设置到 mysql 表中的时间是
0000-00-00 00:00:00 而 <?php echo time() ?> 语句在浏览器中显示 1307018223 ......这是一个有效的 UNIX 时间戳......你可以check the timestamp validity here.
这里是成功update_queryhttp://s3.amazonaws.com/awesome_screenshot/658523?AWSAccessKeyId=0R7FMW7AXRVCYMAPTPR2&Expires=1307020816&Signature=AncPjnzG9p9QTX7zebZp7c9teB0%3D后从mySQL表中取数据的表截图
我做错了什么???如何将合法时间戳从我的 php 传递到 mySQL? [附:我已经检查了我的 mysql 表中的时间戳字段是时间戳字段]
【问题讨论】:
标签: php mysql codeigniter timestamp