PDA

View Full Version : Help with new error


SDP2006
04-18-2004, 02:53 PM
I'm getting this errorColumn count doesn't match value count at row 1 with this code <?php
include"connect.php";
$query = "INSERT INTO `users`(`id`,`username`,`password`,`homepage`,`aol`,`icq`,`msn`,`email`,`name`,`birthday`,`age`,`bio `,`sig`,`interests`,`location`) VALUES('','{$_POST['username']}','{$_POST['password']}','{$_POST['homepage']}','{$_POST['aol']}','{$_POST['icq']}','{$_POST['msn']}','{$_POST['email']}','{$_POST['birthday']}','{$_POST['age']}','{$_POST['bio']}','{$_POST['sig']}','{$_POST['interests']}','{$_POST['location']}')";
mysql_query($query) or die(mysql_error());
echo "Congratulations! You are registered. Proceed to login now.";
?>I don't know why I am getting this error. Everything *looks* fine. Can anyone spot the reason for this error?

Thanks to all.

Stevie

raf
04-18-2004, 05:16 PM
Not realy a descriptive title ...

Anyway, the errormessage is quite selfexplanatory : you have more fields in the fieldslist (15) then values in the valuelist (14).

Also, as a sidenote, if id is an autonum, (chich it shoudl be) then you shouldn't include it inside the fieldlist (and of course then don't supply a value for it).
Also, best use addslaches on strinvalues you insert ...

SDP2006
04-18-2004, 06:36 PM
Ah hah! Gotcha, bloody error.

Thank raf, as always.

raf
04-19-2004, 12:03 AM
You're welcome. (Looks like i broke my typos/word record :rolleyes: )