开发者

In mysql, how can I update timestamp type?

开发者 https://www.devze.com 2023-02-28 07:12 出处:网络
Hi I have a table which have timestamp value, when I write that in php mysql_query(\"UPDATE 开发者_如何学编程table SET

Hi I have a table which have timestamp value, when I write that in php

mysql_query("UPDATE 开发者_如何学编程table SET date=$newdate WHERE name=ibrahim");

it does not work. $newdate is a string value that I read from same table before. How can I change date column? thanks for help...


You need to put string values (including date literals) in quotes for MySQL.

 mysql_query("UPDATE table SET date='$newdate' WHERE name='ibrahim'")


mysql_query("UPDATE table SET date='{$newdate}' WHERE name='ibrahim'"); //quote your strings
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号