Jump to content

Column count doesn't match value count at row 1


mrbean

Recommended Posts

error:

 

error sorryColumn count doesn't match value count at row 1

 

script:

<?php
mysql_query("INSERT INTO `[logs]` (reffer,ip,locatie,gebeurtenis,kenmerk) VALUES ('".$_SERVER['SCRIPT_NAME']."', '".$_SERVER['REMOTE_ADDR']."', 'registreren van account', 'gebruikersnaam = ".htmlentities($_POST['gebruikersnaam'])."')") or die("error sorry".mysql_error());
?>

 

whats the problem and how to fix?

Link to comment
Share on other sites

this error means that the number of columns in your db does not match the number of columns that you are trying to insert into..it looks like in your code that you have 5 columns and you are only adding data into 4 of them..you need blank quotes ('') for any column that you do not wish to add data into

Link to comment
Share on other sites

You've named 5 fields and only provide 4 values. Look at the query formatted differently, and you should be able to see the problem.

 

mysql_query("INSERT INTO `[logs]` (
reffer,
ip,
locatie,
gebeurtenis,
kenmerk
) VALUES (
'".$_SERVER['SCRIPT_NAME']."', 
'".$_SERVER['REMOTE_ADDR']."', 
'registreren van account', 
'gebruikersnaam = ".htmlentities($_POST['gebruikersnaam'])."'
)") or die("error sorry".mysql_error());

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.