DATETIME类型:
MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. (``Supported'' means that although earlier values might work, there is no guarantee that they will.)
也就是说它应该是0000-00-00 00:00:00 这样的而你的$time是time()类型的,HH:MM:SS 例如20:39:15
浅妄薄见,望与斟酌
MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format. The supported range is '1000-01-01 00:00:00' to '9999-12-31 23:59:59'. (``Supported'' means that although earlier values might work, there is no guarantee that they will.)
也就是说它应该是0000-00-00 00:00:00 这样的而你的$time是time()类型的,HH:MM:SS 例如20:39:15
浅妄薄见,望与斟酌
解决方案 »
- 如何在php网页源代码里加入另存为PDF的功能?
- Lost connection to MySQL Server during query
- php 有多少分奉献多少分:: 按照教科书写了一个创建图片缩略图的函数 执行的时候出错 GG们来看看
- PHPLIB 输出多行多列问题
- 哪位帮忙看一下这个文件上传的代码!!
- PHP程序员怎么这么难招啊。
- http://www.a.com/abc.php/b.html 这是什么技术?怎么用?
- 关于microtime
- 对于你来说可能是很简单的问题哦!进来看看吧!
- 关于数组的比较,请大神们帮忙看看。
- 在PHP中连接Mysql 数据库有哪些方法?
- sybase中用php写程序怎样用limit查询语句??
其实完全没必要用 mysql 的 DATE 类型,直接用 int unsigned 类型保存 time() 的返回值也一样
需要显示时间时,用
$str = date("Y-m-d", $time)
就可以将整数时间转换成所需要的形式
$timestr = date("Y-m-d H:i:s", $time);
$xie="insert into new (biaoti,writer,neirong,bigclass,date) values ('$biaoti','$writer','$neirong','$bigclass','$timestr');
$resul=mysql_query($xie);
$resul=mysql_query($xie);
就这么简单!