i have this php code and keep on getting errors upon fixing each error. my code is as follows:
<?php
$id = $_GET['election'];
$result = mysql_query(
sprintf("
SELECT votes.party, COUNT(votes.vote_id)
FROM votes
WHERE election_id = %d
GROUP BY election_id, votes.party
ORDER BY COUNT(votes.vote_id) DESC",
mysql_real_escape_string($id)
)
);
$votes = false;
$winners = array();
while ( ($row = mysql_fetch_row($result) ) && ( ($votes==false) || ($row['vote_count']===$votes) ) ) {
$winners[] = row['party'];
$votes = $row['vote_count'];
}
echo '<hr><h3>'.'Results</h3><hr>'.'<h4>'.implode(' and ', $winners).' won with '.$votes.'</h4>';
?>
error is:
Parse error: syntax error, unexpected '[' in /home/jahedhus/public_html/system2/electoral/countvotes.php on line 84
line 84 is:
$votes = $row['vote_count'];
any ideas guys? thanks in advance