Jump to content

column count didn't match value count at row 1


xanie

Recommended Posts

i couldn't find any errors on it..

<?php
include ("../config/db.php");
$first  = $_POST['first_name'];
$last  = $_POST['last_name'];
$add  = $_POST['address'];
$age  = $_POST['age'];
$gender  = $_POST['gender'];
$contact = $_POST['contact_num'];
$email   =  $_POST['email_add'];
$pass   =  $_POST['password'];
$month  = $_POST['Month'];
$day  = $_POST['Day'];
$year  = $_POST['Year'];
$birthdate = "$month $day, $year";
$full  = "$first $last";
#############---------INSERT DATA-------############
mysql_query
("INSERT INTO register(

first_name,
last_name,
address,
age,
gender,
birthday,
contact_num,
email_add,
password


)
VALUES(
'$first',
'$last',
'$add',
'$age',
'$gender',
'$birthdate'
'$contact'
'$email',
'$pass'


)")or die(mysql_error());
##########------------SEND MAIL----------------############

$message= "$first <br />
  $last <br />
  $pass

  <p>Your email address will serve as your username.</p>
  <p>Thank You!</p>";

echo"$message";

$send_to= $email;
$subject= "Register";
$headers .= 'From: '.$email.'' . "\r\n";
$headers .= "Reply-To: [email]mail@genasiabiotech.com[/email]\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$headers .= "Content-Transfer-Encoding: 8bit;\r\n\r\n";
$headers .= stripslashes($input);
$headers .= "\r\n";

mail($email,$subject,$message,$headers);
?>

Link to comment
Share on other sites

$birthdate = "$month $day, $year";

You are getting the error because your date contains a comma you have commas missing after date and contact values

 

If you are storing dates in a DB table use the DATE or DATETIME types and the format is YYYY-MM-DD. Your current format is useless in a database other than for printing. You cannot do any sorting or date comparisons or easily use any of the dozens of date functions the mysql provides.

Edited by Barand
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.