monkeytooth Posted September 3, 2011 Share Posted September 3, 2011 SELECT * FROM votelog WHERE ipaddress = '127.0.0.1' AND datevoted BETWEEN DATE_SUB( CURDATE( ) , INTERVAL 24 HOUR ) AND CURDATE( ) LIMIT 0 , 30 That is an example of the query I am attempting to run to find posts within the past 24 hours. I am also running a separate one for different needs for in the past 60 minutes. Issue is there is at least 4 rows in the table I am testing with 3 of which fall under the 24 hour clause. this is what the timestamp in the DB looks like, standard DATETIME.. 2011-09-01 13:20:08 with that being said I am yielding no results, well as far as mysql_num_rows($result) seems to be concerned.. Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted September 3, 2011 Author Share Posted September 3, 2011 Figured out my own answer.. it was lousy use of between and curdate().. For those curious the working result would resemble: SELECT * FROM votelog WHERE ipaddress = '127.0.0.1' AND BETWEEN DATE_SUB( datevoted , INTERVAL 24 HOUR ) LIMIT 0 , 30 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.