Thread: php time?
View Single Post
Old 06-10-2009, 07:47 PM   #13 (permalink)
Village Idiot
Wizard
Top Contributor 
 
Village Idiot's Avatar
 
Join Date: Sep 2007
Posts: 1,299
Thanks: 17
Village Idiot is on a distinguished road
Default

Quote:
Originally Posted by DizzyD View Post
Well I knew it wouldn't be long. I'm getting "supplied argument is not a valid MySQL result resource" errors and i'm assuming it is because of the sql statement. Is it a caps lock issue or something? I have no idea..

Here's what i'm working with:

Code:
$sql = "SELECT * FROM credits_temp WHERE DATESUB(CURDATE(),INTERVAL 8 HOURS)>=time";
$query = mysql_query($sql);

while ($row = mysql_fetch_array($query)) {

echo $row['time'];
echo "<br />";

}
Case has no bearing in an SQL query unless you are searching for a case-sensitive value. It is general practice to caps SQL commands and keywords.

Run this:
Code:
$sql = "SELECT * FROM credits_temp WHERE DATESUB(CURDATE(),INTERVAL 8 HOURS)>=time";
$query = mysql_query($sql);

$row = mysql_fetch_array($query) or die(mysql_error());
This will output the error returned.
__________________

Village Idiot is offline  
Reply With Quote