0

Hello i m developing admin panel for my project
i want to add new records
when i fill out the form and hit the add button its redirect me a error message
i dont know how to ride on this error please help thanks!
The error is
Insert failureColumn count doesn't match value count at row 1

$query = "SELECT * FROM person";
	$result = mysql_query($query);
	$nos = mysql_num_rows($result);
	$rno = $nos+1;

	$query = "SELECT * FROM person WHERE fullname = '$parent' LIMIT 1";
	$result = mysql_query($query);
	$objParent = mysql_fetch_object($result);
	
	$query = "INSERT INTO person VALUES('$rno','$name','$gender',$objParent->id,'','$birthday','$email','$profession',
		'$major','$residence','$spousename','$divorceddate','$remarrieddate')";
	$result = mysql_query($query) or die("Insert failure".mysql_error());
2
Contributors
6
Replies
7
Views
5 Years
Discussion Span
Last Post by tahirkhanafridi
0

You have more columns than you specified values for. Either specify the columns too, or add the missing values.

0

can u tell me that insert query is okey or its not valid i dont specified the columns of my db i just specified the values that i am getting from the user.

0

i have total 12 columns and i putted all them but still this error showing on data inserting plz help me
thanks!

0

thanks dear its now solved
i have error on this statement VALUES('$rno','$name','$gender',$objParent->id,'','$birthday','$email','$profession',
here you are seeing '' quotes which are empty i just removed it and my code run perfectly thanks

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.