Reputation: 291
I'm sure I'm getting the vaue of $bn
and $answer
on my page now I just want to insert the value in the column answer value $answer
where qid is $bn
.
<?php
$answer = $_POST['one'];
$an = $_POST['two'];
$bn = $an - 1;
echo "$bn";
$con = mysql_connect('localhost', 'root', 'pankaj') or die(mysql_error());
$db = mysql_select_db('quiz', $con) or die(mysql_error());
$q = "INSERT INTO question(uanswer) VALUE '" . $answer . "' where qid='" . $bn . "'";
$rq = mysql_query($q, $con);
if (!$rq) {
echo " the sql query faiiled to work ";
} else {
echo "the query executed sucessfully";
}
?>
Upvotes: 0
Views: 2257
Reputation: 68476
The INSERT
statement does not support WHERE
clause.
Syntax on how to write an INSERT statement.
Upvotes: 1
Reputation: 567
Do you want to update the database or insert?
INSERT
will not work with WHERE
clause.
Upvotes: 1