Page 1 of 1

Daily Counter Problem

Posted: Sat Apr 14, 2007 11:43 am
by Palgie
Hey guys i need some help with a problem on a small script on my website and i have tryed to fix it many times and i have asked friends of mine who are more experienced and they say they have no idea what is wrong...

What the script is supposed to do is because i run an arcade website it calculates the ammount of game plays in that day, which it does fine until it gets to the timer reseting at the end of the day... the time just constantly adds up and never resets.

Can anyone else see the problem, any help is great fully received!

Code: Select all

<?php

include "../cfg.php";

$db->query("UPDATE info
SET `integer`='0'
WHERE `name`='dayplays'");

$time = time()+60*60*24;

$db->query("DELETE FROM gameplays WHERE `time`<'.$time.'");

?>
Thanks,

Palgie.


EDIT: Checked database info and its all correct...

Posted: Sat Apr 14, 2007 1:59 pm
by onion2k
Your SQL is wrong. If you look at the error message your database is returning you'll see exactly what the problem is. It's very obvious.

Posted: Sat Apr 14, 2007 2:42 pm
by Palgie
Ill have to check in a moment, servers just gone down... will it be under Error Logs?

Posted: Sat Apr 14, 2007 2:48 pm
by John Cartwright
your database object should typically have some sort of error handling.

Normally, you would do

Code: Select all

$result = mysql_query($sql) or die(mysql_error())