经检查,数据库可连接,其他数据录入无错。。date字段类型datetime无错。。
设置时间:date_default_timezone_set('PRC');
获取系统当前时间并转成datetime格式:$userdate = date("Y-m-d H:i:s",strtotime('now'));
添加数据的sql语句:$sql = "INSERT INTO users (date) VALUES ($userdate) ";
然后执行后报错:
You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near '20:06:31)' at line 1
求大神啊!!!到底哪里错了!!急!!