解决方案 »
- 有一个简单的sql语句,提示语法错误,找不到原因,大家给看看
- 请教一个关于php操作mysql的问题,希望大家帮忙。
- 不显示删除回复显示所有回复显示星级回复显示得分回复 【求助】中小企业通用网站后台管理模块的设计开发
- 到底用mysql还是mysqli呢?
- discuz7.2后台http500错误与代码溢出
- 这种alexa查询功能怎么做的???
- 我申请了一个免费空间,怎么用mssql呀
- 编程爱好者网站http://www.programfan.net
- (急)用mail函数发送html邮件的问题。
- PHP网站环境搭建后空白页的问题
- php 提交数据到mysql 出现数据错误
- 怎么把一个MP3名字变为全是数字的名字(哪种加密算法)然后把能他恢复原来的名字
度娘说 要在获取数据库连接时update (set names utf_8)
我加上后,运行报错 Fatal error: Uncaught exception 'DB_Exception' with message '更新失败:Unknown character set: 'utf''
('set names utf8')
不是
(‘set names utf_8')
现在剩下timestamp问题:time()函数不行,我试了date("Y-m-d h:i:s")
问题是写入的时间为:
array(3) { ["org_id"]=> string(1) "1" ["org_name"]=> string(9) "上海市" ["open_time"]=> string(19) "2014-08-23 18:35:18" }
array(3) { ["org_id"]=> string(1) "2" ["org_name"]=> string(20) "北京市" ["open_time"]=> string(19) "0000-00-00 00:00:00" }
array(3) { ["org_id"]=> string(1) "3" ["org_name"]=> string(9) "重庆市" ["open_time"]=> string(19) "0000-00-00 00:00:00" }
array(3) { ["org_id"]=> string(1) "4" ["org_name"]=> string(9) "天津市" ["open_time"]=> string(19) "2014-08-23 12:00:31" }
array(3) { ["org_id"]=> string(1) "5" ["org_name"]=> string(9) "河北省" ["open_time"]=> string(19) "2014-08-23 12:02:34" }
比正常时间慢了8小时,不知道是不是时区的问题,应该怎么设置?
"org_id" => 2,
"org_name" => "北京市",
"open_time" => 'now()'
);
用数据库的时间函数较好你 date 得到的时间不对,是因为你的树区没有设置好
写入的时间是["open_time"]=> string(19) "2014-08-23 08:11:27" ,貌似不是24小时制了
刚试了你的"open_time" => 'now()' 得到的是["open_time"]=> string(19) "0000-00-00 00:00:00" ,我的写入参数都用addslashes转义过,不知道是不是这个问题
now() 等价 date("Y-m-d H:i:s" );