hi guys
merry christmas to all of you
i have made a small poll script
actually i guess there is nothing wrong in it
but i dunno why it doesnt work
please help me
the first script poll.php displays the questions
<?php
include("config.php");
?>
<form name="poll" action="store.php" method="get">
<?php
$question_query = "select * from question";
$question_query_result = mysql_query($question_query,$connectparam);
$question_query_row = mysql_fetch_row($question_query_result);
?>
<?php print("$question_query_row[1]<br><br>"); ?>
<?php
$answer_query = "select * from answer";
$answer_query_result = mysql_query($answer_query,$connectparam);
$i=1;
while($answer_query_row = mysql_fetch_row($answer_query_result)) {
print("$answer_query_row[2] <input type=\"radio\" name=\"user_vote\" value=\"$i\"><br>");
$i++;
}
?>
<br><input type="submit" name="Submit" value="Submit">
</form>
second it passes $user_vote variable value to store.php
<?php
include("config.php");
$store_query = "UPDATE answer SET votes=votes+1 where id=$user_vote";
$store_query_result = mysql_query($store_query,$connectparam);
?>
so i guess it must update votes column where id=$user_vote
but it doesnt
help me please
the other files and database scheme are as follows
config.php
<?php
$dbhost='localhost';
$dbusername='root';
$dbpassword='';
$dbname='poll';
$connectparam = mysql_connect($dbhost,$dbusername,$dbpassword);
mysql_select_db($dbname);
?>
database scheme
structure of question table
CREATE TABLE question (
id tinyint(3) unsigned DEFAULT '0' NOT NULL,
question varchar(255) NOT NULL,
PRIMARY KEY (id),
UNIQUE id (id),
KEY id_2 (id)
);
structure of answer table
CREATE TABLE answer (
id tinyint(3) unsigned DEFAULT '0' NOT NULL,
question_id tinyint(3) unsigned DEFAULT '0' NOT NULL,
answer varchar(255) NOT NULL,
votes int(10) unsigned DEFAULT '0' NOT NULL,
PRIMARY KEY (id),
UNIQUE id (id),
KEY id_2 (id)
);
thanks anyway
i am sure many of you are gonna help me