I am using mySql and my table column date is DATETIME type
But i want to compare only today’s date not time
$today = date("Y-m-d", time());
IF i compare date using above method it always come wrong.
$this->update("
UPDATE `stats_tracker`
SET
`user_agent`='$this->visitor_user_agent' ,
`referrer`='$this->referrer_page' ,
`page_views`='$page_views'
WHERE
`visitor_ip`='$this->visitor_ip'
AND `page`='$this->this_page'
AND `date`='$today'");
Please Help me i am not a good mySQL programmer.
there is a mysql function called DATE which extract the date part of a date or datetime expression
edit: be carefull, as said in the comments below, using this will bypass index on datetime field. You should use instead :