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 Link to comment https://forums.phpfreaks.com/topic/185109-problem-outputting-query/ 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']. Link to comment https://forums.phpfreaks.com/topic/185109-problem-outputting-query/#findComment-977138 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 Link to comment https://forums.phpfreaks.com/topic/185109-problem-outputting-query/#findComment-977168 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. Link to comment https://forums.phpfreaks.com/topic/185109-problem-outputting-query/#findComment-977233 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 Link to comment https://forums.phpfreaks.com/topic/185109-problem-outputting-query/#findComment-977379 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.