prepare('SELECT * FROM tblsurvey WHERE ID = ?'); if ($SQL) { $SQL->bind_param('i', $qNum); $SQL->execute(); $result = $SQL->get_result(); if ($result->num_rows > 0) { $db_field = $result->fetch_assoc(); $question = $db_field['Question']; $answerA = $db_field['OptionA']; $answerB = $db_field['OptionB']; $answerC = $db_field['OptionC']; $qA = $db_field['VotedA']; $qB = $db_field['VotedB']; $qC = $db_field['VotedC']; $totalP = $qA + $qB + $qC; $percentA = (($qA * 100) / $totalP); $percentA = floor($percentA); $percentB = (($qB * 100) / $totalP); $percentB = floor($percentB); $percentC = (($qC * 100) / $totalP); $percentC = floor($percentC); $imgWidthA = $percentA * 2; $imgWidthB = $percentB * 2; $imgWidthC = $percentC * 2; $imgTagA = ""; $imgTagB = ""; $imgTagC = ""; } else { print "ROW ERROR"; } } } else { print "database error"; } } else { print "no results to display"; } ?> Survey Results "; print $answerA . " " . $imgTagA . " " . $percentA . "% " . $qA . "
"; print $answerB . " " .$imgTagB . " " . $percentB . "% " . $qB . "
"; print $answerC . " " .$imgTagC . " " . $percentC . "% " . $qC . "
"; ?>