Column count doesn't match value count at row

Custom / CUSTOM
February 3, 2010 at 17:07:32
Specs: Windows XP, 8g
Hi, I'm having a bit of trouble with inputing data
to my MySQL database. I get the error
"Column count doesn't match value count at
row 1" when I hit 'Submit' on the HTML page.
My code is below.

-- HTML PAGE--

<html>
<body>

<form action="register.php"
method="post">

Username: <input type="text" name="user"
/>

Password: <input type="text" name="pass"
/>

First Name: <input type="text"
name="firstname" />

Last Name: <input type="text"
name="lastname" />

Email: <input type="text" name="email"
/>

Country: <input type="text" name="country"
/>

<input type="submit" />

</form>

</body>
</html>


-- PHP SCRIPT --

<?php
$con =
mysql_connect("localhost","xxxxx","xxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

mysql_select_db("galsyn", $con);

$sql="INSERT INTO users (user, pass,
firstname, lastname, email, country, regtime)
VALUES
('$_POST[user]','$_POST[pass]','$_POST[firstn
ame]','$_POST[lastname]','$_POST[email]','$_
POST[country]')";


if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";

mysql_close($con)
?>


See More: Column count doesnt match value count at row

Report •

#1
February 3, 2010 at 17:25:23
Found the answer, not sure what fixed it but its working, I'll keep
looking for how it fixed. thanks anyway

Report •
Related Solutions


Ask Question