MySQL Forums
Forum List  »  Newbie

MySQL update query problem
Posted by: sn202
Date: March 18, 2005 10:07AM

Hi all,

I'm creating an assesment and Feedback system and I'm using an UPDATE statement to enter $feedback into the required record depending on testno, questionno and answerno, Using a PHP script shown below: My problem is that when running it, I get the following error:

"Unknown column 'feedback' in 'field list'"

However "feedback" defiantly does exist. Any ideas? Any help will be much appreciated.

Regards,

Simon.


<?php
$conn = @mysql_connect( "linuxproj", "****", "****" )
or die( mysql_error() );
#select the specified database
$rs = @mysql_select_db ( "db_sn202", $conn )
or die( mysql_error() );

$testname = $_POST['testname'];
$questionno = $_POST['questionno'];
$answerno = $_POST['answerno'];
$feedback = $_POST['feedback'];

$qry="select testno from test where testname = ('$testname')";
$rs = mysql_query( $qry, $conn )
or die( mysql_error() );
$row=mysql_fetch_object($rs);{
$testno = $row->testno;
Switch($answerno)
{
Case '1' :
$sql="update question set feedback = '$feedback' where
testno = '$testno' and questionno = '$questionno'";
$rs2 = mysql_query( $sql, $conn )
or die( mysql_error() );
break;

Case '2' :
$sql2="update question set feedback2 = '$feedback' where
testno = '$testno' and questionno = '$questionno'";
$rs3 = mysql_query( $sql2, $conn )
or die( mysql_error() );
break;

Case '3' :
$sql3="update question set feedback3 = '$feedback' where
testno = '$testno' and questionno = '$questionno'";
$rs4 = mysql_query( $sql3, $conn )
or die( mysql_error() );
break;

Case '4' :
$sql4="update question set feedback4 = '$feedback' where
testno = '$testno' and questionno = '$questionno'";
$rs5 = mysql_query( $sql4, $conn )
or die( mysql_error() );
break;
}
}
?>

Options: ReplyQuote


Subject
Written By
Posted
MySQL update query problem
March 18, 2005 10:07AM
March 18, 2005 11:13AM
March 19, 2005 07:11AM
March 19, 2005 09:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.