jbroder
02-19-2000, 09:09 PM
I am working on a voting system with php and mysql.
It tracks votes on a variety of topics.
I have it set up to log the REMOTE_ADDR of each voter so that no one can vote over and over again.
I don't need to keep the IPs and votes indefinitely. I just want to prevent one IP from voting twice in the same day or hour or something. So I want to delete old IPs when new votes are logged.
I put in a TIMESTAMP(14) called moddate. I want to use that for the query that deletes old vote logs. Something like
DELETE FROM table where (moddate < yesterday)
The trouble is, I can't figure out how to tell the database "yesterday".
My php time() format is different from the TIMESTAMP format.
(moddate < timestamp -3600) doesn't work
and I don't understand the mysql manual, which seemed to suggest
(moddate < CURRENT_TIME - 3600) doesn't work
Can anybody help?
Thanks,
Jon
It tracks votes on a variety of topics.
I have it set up to log the REMOTE_ADDR of each voter so that no one can vote over and over again.
I don't need to keep the IPs and votes indefinitely. I just want to prevent one IP from voting twice in the same day or hour or something. So I want to delete old IPs when new votes are logged.
I put in a TIMESTAMP(14) called moddate. I want to use that for the query that deletes old vote logs. Something like
DELETE FROM table where (moddate < yesterday)
The trouble is, I can't figure out how to tell the database "yesterday".
My php time() format is different from the TIMESTAMP format.
(moddate < timestamp -3600) doesn't work
and I don't understand the mysql manual, which seemed to suggest
(moddate < CURRENT_TIME - 3600) doesn't work
Can anybody help?
Thanks,
Jon