Wolfsoap Posted January 25, 2008 Share Posted January 25, 2008 'SELECT date, tags, count(tags) as numberOfTags FROM journal WHERE date BETWEEN "1990-01-01" AND $now GROUP BY tags' This works but doest come back with the right results, i was wondering why. It come backs with the lits of tags and numbers, but it doesn't filter out the dates it should, it just returns every row, regardless of whether the date falls in the criteria or not. Can someone tell me whats up with it please? Quote Link to comment https://forums.phpfreaks.com/topic/87822-solved-uncouth-sql/ Share on other sites More sharing options...
cooldude832 Posted January 25, 2008 Share Posted January 25, 2008 if you are selected the tags just do mysql_num_rows instead of a count. Quote Link to comment https://forums.phpfreaks.com/topic/87822-solved-uncouth-sql/#findComment-449246 Share on other sites More sharing options...
PHP Monkeh Posted January 25, 2008 Share Posted January 25, 2008 And $now is? Quote Link to comment https://forums.phpfreaks.com/topic/87822-solved-uncouth-sql/#findComment-449247 Share on other sites More sharing options...
Wolfsoap Posted January 25, 2008 Author Share Posted January 25, 2008 Im not bothered about the row counting that all works fine, it the date filtering that dosen't. and $now is just the current date in the right format. Quote Link to comment https://forums.phpfreaks.com/topic/87822-solved-uncouth-sql/#findComment-449254 Share on other sites More sharing options...
cooldude832 Posted January 25, 2008 Share Posted January 25, 2008 take your query that php makes to phpmyadmin and see what it outputs there $q = 'SELECT date, tags, count(tags) as numberOfTags FROM journal WHERE date BETWEEN "1990-01-01" AND NOW(); GROUP BY tags' echo "<Br /><br />".$q."<br /><br />"; Quote Link to comment https://forums.phpfreaks.com/topic/87822-solved-uncouth-sql/#findComment-449258 Share on other sites More sharing options...
Wolfsoap Posted January 25, 2008 Author Share Posted January 25, 2008 Neat. That worked. Regards, Cool Dude 832. Quote Link to comment https://forums.phpfreaks.com/topic/87822-solved-uncouth-sql/#findComment-449273 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.