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?

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

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());

Archived

This topic is now archived and is closed to further replies.

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