0

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";
}
?>
1
  • Use Update Insert not support where condition. Commented Mar 21, 2014 at 9:46

2 Answers 2

1

Do you want to update the database or insert? INSERT will not work with WHERE clause.

Sign up to request clarification or add additional context in comments.

Comments

1

The INSERT statement does not support WHERE clause.

Syntax on how to write an INSERT statement.

7 Comments

this is weired,this is second time I am facing this
@ Shankar Damodaran but its not letting me do urs,but why this is happening?is it by some moderators?
@Abhishek, Doesn't matter.
Why did you delete this answer: stackoverflow.com/questions/22556648/…
@CasimiretHippolyte, Because it didn't get any attention ..moreover that solution was not regex based.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.