Twist3d Posted December 21, 2009 Share Posted December 21, 2009 Hello. Well im trying to make like a voting system, where you can only vote for 1 thing every 12 hours. Mate of mine suggested IP logging. So i made a script where it Logs the IP and Gives it a random timestamp (Haven't added that, but i just use Insert on PHPMyAdmin). What this does, is the code searchs for your IP in the database, if it shows your IP is in there, it won't let you into the site. If it doesn't, then your aloud in. But what im trying to do is make the code Delete your IP from the Database, so you are free to vote again. Im trying to get this to work every 20 seconds as a Test, but it will be doing it every 12 hours. But the code works, atleast i think it does? But it doesn't delete anything. But it doesn't give me an error log either. $query = "DELETE * FROM iplog WHERE UNIX_TIMESTAMP(Timestamp) < ' . (time() - 10)"; mysql_query($query); ?> The Timestamp field is just a Default Timestamp. Any help? Link to comment https://forums.phpfreaks.com/topic/185884-delete-from-timestamp/ Share on other sites More sharing options...
Twist3d Posted December 21, 2009 Author Share Posted December 21, 2009 Any help? Please? Link to comment https://forums.phpfreaks.com/topic/185884-delete-from-timestamp/#findComment-981589 Share on other sites More sharing options...
mrMarcus Posted December 21, 2009 Share Posted December 21, 2009 your syntax is incorrect for DELETE .. check the manual: http://dev.mysql.com/doc/refman/5.0/en/delete.html would be something more along the lines of: $query = "DELETE FROM iplog WHERE UNIX_TIMESTAMP(Timestamp) < ' . (time() - 10)"; that random ' will also throw an error. add trigger_error() to your query: mysql_query($query) or trigger_error (mysql_error()); Link to comment https://forums.phpfreaks.com/topic/185884-delete-from-timestamp/#findComment-981590 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.