Php/mysql posting COUNT(*) FROM Poll total yes/no?

That's because you're echoing out a query object. Each of your queries should be $vote_yes = mysql_query("SELECT COUNT(*) AS total FROM Poll WHERE vote = 'yes' "); $row = mysql_fetch_object($vote_yes); echo $row->total; //echoes out the number of yes votes.

That's because you're echoing out a query object. Each of your queries should be... $vote_yes = mysql_query("SELECT COUNT(*) AS total FROM Poll WHERE vote = 'yes' "); $row = mysql_fetch_object($vote_yes); echo $row->total; //echoes out the number of yes votes.

You are misunderstanding how GROUP BY works. You do not use it to select an answer, it is used to select a field, by which aggregate functions are grouped. If you use: SELECT `vote`, COUNT(*) FROM Poll GROUP BY `vote` Then this will return two results, each with two values, the vote (yes or no) and the count for that vote.

$handle = mysql_query("SELECT `vote`, COUNT(*) AS `count` FROM Poll GROUP BY `vote` ORDER BY `vote` DESC"); if ($handle) { $results = mysql_fetch_assoc($handle); echo ($results0'count' + $results1'count') . "" . $results0'count' ."" .

$results1'count'; } NB. Using the ORDER BY vote DESC part, that forces the order to yes then no (reverse alphabetical) and then you do not have to check which row is which.

You do not use it to select an answer, it is used to select a field, by which aggregate functions are grouped. Then this will return two results, each with two values, the vote (yes or no) and the count for that vote. Using the ORDER BY vote DESC part, that forces the order to yes then no (reverse alphabetical) and then you do not have to check which row is which.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions