I tried adding echos as follows:
Code: Select all
<?php
$query = "SELECT * FROM Poll ORDER BY PollID";
$num_votes_query = mysql_query($query);
$six_votes = 'false';
do {
while ($num_votes = mysql_fetch_array($num_votes_query)) {
if ($num_votes[7] < '5') {
$six_votes == 'true';
$pollid = $num_votes[0];
$query = "SELECT * FROM Poll WHERE PollID = '$pollid'";
echo "if";
break;
}
echo "while";
}
if ($six_votes == 'true') {
break;
}
echo "dowhile";
} while ($six_votes == 'false');
?>
The output was:
ifdowhileifdowhileifdowhileifdowhile...
It breaks out of the interior while ok it seems since I don't get that echo statement.
I'll try to explain the situation better. I have a database table Poll with PollID, PollQ, PollA1, PollA2, PollA3, PollA4, NumQuestions, TotalVotes. Now instead of getting the most recent poll, I want the most recent poll with under 6 votes. Hence if PollID = 1 has TotalVotes = 6, I want to check to see how many votes are in PollID = 2. If there are only 3 votes in PollID = 2, then I want my query statement to have WHERE PollID = 2. Does that make sense at all, or am I completely nuts?