Jump to content

Last twelve hours echoed from MySQL


suttercain

Recommended Posts

MySQL server version for the right syntax to use near ' INTERVAL -12 HOUR)' at line 1

 

: (

 

$sql = mysql_query("SELECT * FROM latestGreatest WHERE latestTime = HOUR('".$time."', INTERVAL -12 HOUR)") or die(mysql_error());

I switched over time a timestamp to test out this code

 

$sql = mysql_query("SELECT * FROM latestGreatest WHERE `latestTimeStamp` between (CURRENT_TIMESTAMP()) AND (CURRENT_TIMESTAMP() - INTERVAL 12 HOUR)") or die(mysql_error());
			$total = mysql_num_rows($sql);
			echo "$total";

 

I am still getting zero number of rows, but there should be two.

 

Any advice?

 

Thanks

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.