任何人都可以帮助我以下吗?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