# Register.php help

**URL:** <https://forum.kirupa.com/t/register-php-help/208072>\
**Category:** Uncategorized\
**Created:** [November 24, 2006, 5:12pm UTC](https://forum.kirupa.com/t/register-php-help/208072 "2006-11-24T17:12:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ptsu](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/ptsu/32/3028_2.png) [@ptsu](https://forum.kirupa.com/u/ptsu)\
**Post date:** [November 24, 2006, 5:12pm UTC](https://forum.kirupa.com/t/register-php-help/208072/1 "2006-11-24T17:12:36Z")

</div>

Hello,

Here is my problem. Visit [www.goality.com/register.htm](http://www.goality.com/register.htm) 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:  
\<?php

include(“config.php”);

// 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  
mysql\_select\_db($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\>”;  
exit;  
} 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
