daydreamer Posted July 31, 2009 Share Posted July 31, 2009 $time=time(); $onedayago=$time-86400; //86400 seconds in 24 hrs, 5 texts in any one 24 hr period $checkpass = mysql_query("SELECT * FROM texts WHERE id='{$_SESSION['id']}' AND date >'$onedayago' ") I am trying to select all rows that have a date column from the last 24hrs, the date column is in mktime format. All I need is a count. Is this the way to do it? Thanks. Link to comment https://forums.phpfreaks.com/topic/168312-bigger-than-operator-in-sql-passing-variables-to-sql/ Share on other sites More sharing options...
TeNDoLLA Posted July 31, 2009 Share Posted July 31, 2009 $result = mysql_query("SELECT COUNT(id) AS `count` FROM texts WHERE id='{$_SESSION['id']}' AND date >'$onedayago' "); $result = mysql_fetch_array($result); echo $result[0]['count']; fixed it a little and somefield could be any field that is in the table. Link to comment https://forums.phpfreaks.com/topic/168312-bigger-than-operator-in-sql-passing-variables-to-sql/#findComment-887805 Share on other sites More sharing options...
daydreamer Posted July 31, 2009 Author Share Posted July 31, 2009 Thanks. What should some_field be? Link to comment https://forums.phpfreaks.com/topic/168312-bigger-than-operator-in-sql-passing-variables-to-sql/#findComment-887806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.