Register.php help


Here is my problem. Visit and fill out the form. You will see the following error.

“Could not insert data because Column count doesn’t match value count at row 1”

Why does this happen? Any solutions?

My register.php file looks like the following:


// connect to the mysql server
$link = mysql_connect($server, $db_user, $db_pass)
or die ("Could not connect to mysql because ".mysql_error());

// select the database
or die ("Could not select database because ".mysql_error());

// check if the username is taken
$check = “select id from $table where username = '”.$_POST[‘username’]."’;";
$qry = mysql_query($check)
or die ("Could not match data because ".mysql_error());
$num_rows = mysql_num_rows($qry);
if ($num_rows != 0) {
echo “Sorry, there the username $username is already taken.<br>”;
echo “<a href=register.htm>Try again</a>”;
} else {

// insert the data
$insert = mysql_query(“insert into $table values (‘NULL’, '”.$_POST[‘username’]."’, ‘".$_POST[‘password’]."’)")
or die("Could not insert data because ".mysql_error());

// print a success message
echo “Your user account has been created!<br>”;
echo “Now you can <a href=login.htm>log in</a>”;


Thanks for the support.

Eric Su