[SOLVED] Poll problem
Posted: Wed Dec 10, 2003 11:20 am
It's my first poll, so...
It throws following error every time:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource
here's the code:
Any help appreciated...
It throws following error every time:
Warning: mysql_result(): supplied argument is not a valid MySQL result resource
here's the code:
Code: Select all
<?php
function polli() {
require "../dbconn.php";
$stringi = "SELECT id FROM polli-1";
$stringi2 = "INSERT INTO polli-1(id,a,b) VALUES ('','$va','$vb')";
if(isset($action) && ($action == "vote")) {
mysql_query($stringi2);
}
$count1= mysql_result(mysql_query("SELECT COUNT(a) FROM polli-1 WHERE a=1"),0);
$count2= mysql_result(mysql_query("SELECT COUNT(b) FROM polli-1 WHERE b=1"),0);
if($count1!= 0) {
if($count2 != 0) {
echo "<table width=300><tr><td><form action=?show=poll&action=vote method=post>";
echo "<input name=va type=radio value=1> option 1<br>";
echo "<input name=vb type=radio value=1> option 2<br>";
echo "<input type=submit value=vote name=do_vote></form>";
echo "</td></tr>";
echo "<tr><td height=5 bgcolor=#cccccc width=".$count1."> ".$count1."<td><tr>";
echo "<tr><td height=5> </td></tr>";
echo "<tr><td height=5 bgcolor=#cccccc width=".$count2."> ".$count2."</td></tr></table>";
}
}
}
?>