我想将日期时间插入到mysql表中的列中。PHP日期时间插入到mysql
<?php
//Some code
date_default_timezone_set('Europe/London');
//Other variables defined also
$date_time = new DateTime();
$queryreg = mysql_query ("
INSERT INTO users VALUES ('','$username','$password','$email','$website','$image','$date_time')
");
?>
但是浏览器指出: “开捕致命错误:类的DateTime的对象无法转换为字符串C:\ XAMPP \ htdocs中\设计\线181上register.php”。任何想法为什么这样做?提前谢谢了。
可能重复[在MySQL查询中使用php DateTime对象](http://stackoverflow.com/questions/10489386/using-php-datetime-object-in-mysql-query) –