Please tell me why this wont work,
[php]
mysql_connect(“blank”, “blank”, “blank”) or die(mysql_error());
mysql_select_db(“blank”) or die(mysql_error());
//Name of our cookie
$cookie = “Voted”;
function pie() {
$data = mysql_query(“SELECT * FROM poll”) or die(mysql_error());
$result = mysql_fetch_array( $data );
$total = $result[contractor] + $result[myself] + $result[third];
$total = $result[contractor] + $result[myself] + $result[third];
$one = round (360 * $result[contractor] / $total);
$two = round (360 * $result[myself] / $total);
$per1 = round ($result[contreactor] / $total * 100);
$per2 = round ($result[myself] / $total * 100);
$per3 = round ($result[third] / $total * 100);
echo “<img src=vote_pie.php?one=”.$one."&two=".$two.">
";
echo “FIRST = $result[contractor] votes, $per1 %
SECOND = $result[myself] votes, $per2 %
THIRD = $result[third] votes, $per3 %
”;
}
//This runs if it is in voted mode
if ( $mode==“voted”) {
//makes sure they haven’t already voted
if(isset($_COOKIE[$cookie])) {
echo “Sorry You have already voted this month
”;
} else {
//sets a cookie
$month = 2592000 + time();
setcookie(Voted, Voted, $month);
// adds their vote to the database
switch ($vote) {
case 1:
mysqli_query($con,“UPDATE poll SET contractor = contractor+1”);
break;
case 2:
mysqli_query($con,“UPDATE poll SET myself = myself+1”);
break;
case 3:
mysqli_query($con,“UPDATE poll SET third = ignore+1”);
}
//displays the poll results
pie ();
}
}
//if they are not voting, this displays the results if they have already voted
if(isset($_COOKIE[$cookie])) {
pie ();
} else {
// or if they have not voted yet, they get the voting box
if(!$mode==‘voted’) {
?>