任何人都可以幫助我以下嗎?php mysql where where clause使用日期
$crDate = date("Y-m-d");
$sql="update callrecord set crEndtime = Now() where crUsId = ".$crUsId."AND crDate = ".$crDate;
我試圖做的是更新表「callrecord」其中crDate
是當前日期。當我把部分拿出來時,它工作正常。
$sql="update callrecord set crEndtime = Now() where crUsId = ".$crUsId;
這工作正常。但我想查看當前的日期。任何幫助?
您通常會將日期輸入爲字符串,因此您需要引用它。例如'SELECT * FROM Orders WHERE OrderDate ='2008-11-11';'[Source](http://www.w3schools.com/SQl/sql_dates.asp)here。日期時間是'2008-11-11 03:29:12'; – styfle 2011-04-26 01:35:08