开发者

In mysql, how can I update timestamp type?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜