Porkie Posted December 14, 2009 Share Posted December 14, 2009 $labourcount = "SELECT COUNT(Party) FROM users WHERE party='Labour'"; $result = mysql_query($labourcount); $row = mysql_fetch_array($result); echo 'Created On '.$row['result']; how can i output the result from this? sorry im just confused? thanks for help in advance Quote Link to comment Share on other sites More sharing options...
cags Posted December 14, 2009 Share Posted December 14, 2009 There are lots of ways, changing $row['result'] to $row[0] should work, alternatively you can change your query to... SELECT COUNT(Party) AS party_count FROM users WHERE party='Labour' ... and then use $row['party_count']. Quote Link to comment Share on other sites More sharing options...
Porkie Posted December 14, 2009 Author Share Posted December 14, 2009 cheers still have a problem, this is my code $labourcount ="SELECT COUNT(Party) AS party_count FROM users WHERE party='Labour'"; echo 'Created On '.$row['party_count']; thanks Quote Link to comment Share on other sites More sharing options...
cags Posted December 14, 2009 Share Posted December 14, 2009 That is essentially correct (assuming you still have the mysql_query and mysql_fetch_array rows in their of course). You have used `Party` for the COUNT and `party` for the WHERE, but that shouldn't matter. Quote Link to comment Share on other sites More sharing options...
Porkie Posted December 14, 2009 Author Share Posted December 14, 2009 what is the easy way off doing this, as im trying to perform 5 queries on the same page? any help? cheers 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.