Daily Counter Problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Palgie
Forum Newbie
Posts: 2
Joined: Sat Apr 14, 2007 11:38 am

Daily Counter Problem

Post 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...
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post 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.
Palgie
Forum Newbie
Posts: 2
Joined: Sat Apr 14, 2007 11:38 am

Post by Palgie »

Ill have to check in a moment, servers just gone down... will it be under Error Logs?
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post 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())
Post Reply