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][email protected][/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);
?>

$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.

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.