Jump to content

Update Query with AND..


techker

Recommended Posts

hey guys i need to update my traffic table with the log out time..

 

i record logging and would like to add the log out time..

 

 

i tried this..no success

 


  date_default_timezone_set('EST');
	   
	   //Time & Date
		$date = date ('m/d/y  g:i a');
		$ip = $_SERVER['REMOTE_ADDR'];

$query = "UPDATE  `traffic` SET  `page` =  '$date' WHERE  `date` = CURDATE() AND 'ip' = '$ip";   
$results = mysql_query( $query );

Link to comment
https://forums.phpfreaks.com/topic/252508-update-query-with-and/
Share on other sites

the mysql function CURDATE() returns the date in the format of YYYY-MM-DD' or YYYYMMDD depending on whether it is used in string or numeric context. you will need to match that format with your date() function in order for the query to grab the correct row.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.