Can anyone help me with the following开发者_StackOverflow社区?
$crDate = date("Y-m-d");
$sql="update callrecord set crEndtime = Now() where crUsId = ".$crUsId."AND crDate = ".$crDate;
What I'm trying to do is update a table "callrecord" where the crDate is current date. when I take the And part out, it works fine.
$sql="update callrecord set crEndtime = Now() where crUsId = ".$crUsId;
this works fine. But I want to check with current date too. any help?
You can use MySQL function curdate() without calculating it within php.
$sql = "update callrecord set crEndtime = Now() 
        where crUsId = '$crUsId' AND crDate = curdate()";
I think you should try using single quotes arround the $crDate.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论