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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.