Canman2005 Posted April 21, 2007 Share Posted April 21, 2007 Hi all I have the following query SELECT COUNT(*) as Num FROM files GROUP BY categoryid The problem is that if I run this query in phpmyadmin, I get a total of 4, which is right. But if I run this query within a php page, I only get 2 as a result. Can anyone tell me why I get a different result? Any advice would be great Thanks Ed Quote Link to comment Share on other sites More sharing options...
AndyB Posted April 21, 2007 Share Posted April 21, 2007 And are you completely certain that you're working on the same database/same table/same data? Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted April 21, 2007 Author Share Posted April 21, 2007 Yep, 100%, the whole query code is $total = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM files GROUP BY categoryid"),0); print $total; and my database looks like id categoryid 223 9 224 9 225 10 226 10 227 10 228 11 229 11 230 11 231 12 Can anyone see anything that is wrong? Thanks Ed Quote Link to comment Share on other sites More sharing options...
Canman2005 Posted April 21, 2007 Author Share Posted April 21, 2007 its still returning 2, anyone got any bright ideas? 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.