reakt Posted February 25, 2011 Share Posted February 25, 2011 Hi Guys I have a datetime field in my database which is updated when a user loads a particular page. What I want to do is create a graph showing how many users hit that page each day for a range of dates. The only way I can think of to do this is to increment through each date in the range, counting how many matches in the database for each date. 1. Is there a better (more efficient) way to do this, considering that on some days there will be no matches? 2. I'm trying to count like this: $date = date('Y/m/d'); $sql = "SELECT COUNT(*) FROM MailMerge WHERE landed= '$date';"; but I get "Data type mismatch in criteria expression". I guess I have to format the date somehow so MS SQL knows how to match it? Here is how I'm storing my dates: $now = date('Y/m/d'); $sql = "UPDATE MailMerge SET landed = '$now' WHERE membership = '$membership';"; Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/228767-count-range-of-date-entries/ 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.