SharkBait Posted June 15, 2006 Share Posted June 15, 2006 Not sure how I would set up for something like this.I have a site where users enter information in and it gets time stamped to a MySQL Database.What I want to do is display to the users how many entries are entered at any given time over the course of an hour.So an Entries Per Hour kinda deal.Would I make the query look like:[code]SELECT count(*) FROM myTable WHERE date_entered >= AN AN HOUR AGO FROM NOW[/code]Not sure if I would use SQL's time functions or PHP's Time functions, and how :)Thanks Quote Link to comment https://forums.phpfreaks.com/topic/12104-counter-per-hour/ Share on other sites More sharing options...
Barand Posted June 15, 2006 Share Posted June 15, 2006 You could do the whole day with[code]$res = mysql_query("SELECT DATE_FORMAT(tstamp, '%h %p') as hour, COUNT(*) as total FROM tablename GROUP BY hour") or die(mysql_error());while (list($hour, $total) = mysql_fetch_row($res)) { echo "$hour : $total<br>";}[/code] Quote Link to comment https://forums.phpfreaks.com/topic/12104-counter-per-hour/#findComment-46094 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.