Jump to content

inserting query error


FURQAN

Recommended Posts

hi there my name is furqan ahmed and i am having problem in inserting record in two tables at the same time i have posted the code in this code "$query" is running but "$query1" is not running any help from your side will be highly appreciated waiting for ur reply

 

if(isset($_POST['submit1'])) {
			$question=$_POST['question'];
			$option1=$_POST['option1'];
			$option2=$_POST['option2'];
			$option3=$_POST['option3'];
			$option4=$_POST['option4'];
			$answer=$_POST['answer'];
			$query="INSERT INTO questions VALUES('$question','$option1','$option2','$option3','$option4')";
			$result=mysql_query($query) or die('cannot be updated');
			$query1="INSERT INTO answer VALUES('','$answer')";
			$result1=mysql_query($query1) or die('cannot update query1');

Link to comment
https://forums.phpfreaks.com/topic/205711-inserting-query-error/
Share on other sites

brothers

from $query1 i am getting the following ,ysql_error()

 

Incorrect integer value: '' for column 'question' at row 1

 

$query1="INSERT INTO answer VALUES('','$answer')";

i have used '' in inserting the first field because the field is auto incremented

is it the problem

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.