476 PHP i MySQL dla każdego
function showPollResults(Sid)
$query = "SEIECT Nazwa FROM Ankiety WHERE id=Sid": if(!Sresult - mysql_query($query)){ return false:
if(!$row = mysql_fetch_row($resu1t)){ return false:
}
echo("<table align=\"center\"><tr><td colspan-'2'><b>$row[0]</b></tdx/tr>");
$query = ''SELECT Opcja. Glosy FROM AnkietyOpcje
$query "WHERE Ankietald = $1d ORDER BY Glosy DESC":
if(!$result ■ mysql_query($query)){ return false:
while($row = @mysql_fetch_row($result)){ echo("<tr>"): echo(”<td>Srow[0]</td>”): echo(“<td>$row[l]</td>"): echo("</tr>”):
}
echo("</table>"):
return true: function showAllPollsResultsO
Squery = "SELECT Id FROM Ankiety WHERE Status=l": if(!$result - mysql_query($query)){ return false:
while($row = @mysql_fetch_row{Sresult)){ showPollResults($row[0]):
return true: function vote($ankietaId. Sopcjald)
$query = "UPDATE AnkietyOpcje SET Glosy=Glosy + 1 WHERE $query .= "id = Sopcjald"; ifdSresult - @mysql_query(Squery)){ return false;
Sf_result = mysql_affected_rows():
Squery = "SELECT Id FROM Users WHERE Nazwa='$_SESSION[zalogowany]'";
if($result - @niysql_query($query)){
Srow = mysql_fetch_row(Sresult): if(Srow){
Squery = "INSERT INTO AnkietyOddaneGlosy VALUES":
Squery "(Sankietald. $row[0])":