naveenbj Posted January 20, 2008 Share Posted January 20, 2008 Hello Friend, I hav a small issue whr i m not able to find out wher i m wrong. here is the code <?php $con=mysql_connect('localhost' , 'com_testuser' , 'testpassword'); if(!$con) { die('Could not connect' .mysql_error()); } else mysql_select_db('com_nag1',$con); $name = $_POST['name']; $lastname = $_POST['lastname']; $email = $_POST['email']; $birth = $_POST['birth']; $radiobutton = $_POST['radiobutton']; $phone = $_POST['phone']; $mobile = $_POST['mobile']; $fax = $_POST['fax']; $query="INSERT INTO form_info(name, LastName, Email, BirthDate, Gender, Address, Phone, Mobile, Fax) VALUES ('$name' , '$lastname' , '$email' , '$birth' , '$radiobutton' ,'$phone' , '$mobile' , '$fax')"; /*$query="INSERT INTO 'form_info'(FirstName, LastName, Email, BirthDate, Gender, Address, Phone, Mobile, Fax) VALUES('$name','$lastname','$email','$birth','$radiobutton','$address','$phone','$mobile','$fax')";*/ if(!mysql_query($query,$con)) { die('Error' . mysql_error()); } echo "One record added"; mysql_close(); ?> This code is for retriving data from a form and it will save the data in mysql table. but from this code i got this error mesg "ErrorColumn count doesn't match value count at row 1 " --------------------------- any suggestions would be highly appriciated!! Regards, Nj Quote Link to comment https://forums.phpfreaks.com/topic/86934-solved-php-mysql-data-retrieve-problem/ Share on other sites More sharing options...
toplay Posted January 20, 2008 Share Posted January 20, 2008 You're missing the address value. That error means the number of columns you specified (9 total) don't match the number of values you have (8 total). Quote Link to comment https://forums.phpfreaks.com/topic/86934-solved-php-mysql-data-retrieve-problem/#findComment-444464 Share on other sites More sharing options...
naveenbj Posted January 20, 2008 Author Share Posted January 20, 2008 You're missing the address value. That error means the number of columns you specified (9 total) don't match the number of values you have (8 total). Thanks for reply!! but i still getting the same result:( Regards, Nj Quote Link to comment https://forums.phpfreaks.com/topic/86934-solved-php-mysql-data-retrieve-problem/#findComment-444466 Share on other sites More sharing options...
toplay Posted January 20, 2008 Share Posted January 20, 2008 You should have posted your current code. I assume you didn't fix it right or are getting the error on a different query (in another part of the code). In your original post, the query that's commented out is actually correct in terms of number of columns listed match the number of values given. Check that you did something like the following (items in red are missing): $address = $_POST['address']; // whatever you called the form name $query="INSERT INTO form_info(name, LastName, Email, BirthDate, Gender, Address, Phone, Mobile, Fax) VALUES ('$name' , '$lastname' , '$email' , '$birth' , '$radiobutton', '$address', '$phone' , '$mobile' , '$fax')"; Quote Link to comment https://forums.phpfreaks.com/topic/86934-solved-php-mysql-data-retrieve-problem/#findComment-444474 Share on other sites More sharing options...
naveenbj Posted January 20, 2008 Author Share Posted January 20, 2008 You should have posted your current code. I assume you didn't fix it right or are getting the error on a different query (in another part of the code). In your original post, the query that's commented out is actually correct in terms of number of columns listed match the number of values given. Check that you did something like the following (items in red are missing): $address = $_POST['address']; // whatever you called the form name $query="INSERT INTO form_info(name, LastName, Email, BirthDate, Gender, Address, Phone, Mobile, Fax) VALUES ('$name' , '$lastname' , '$email' , '$birth' , '$radiobutton', '$address', '$phone' , '$mobile' , '$fax')"; Thanks "toplay" . Yes ur idea works for me:) Regards Nj Quote Link to comment https://forums.phpfreaks.com/topic/86934-solved-php-mysql-data-retrieve-problem/#findComment-444479 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.