Error: Column count doesn't match value count

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
brcolow
Forum Newbie
Posts: 2
Joined: Sun Sep 29, 2002 7:25 pm

Error: Column count doesn't match value count

Post by brcolow »

Hi, in my php/mysql script i get this error...


Column count doesn't match value count at row 1


Waht does that mean and hiow can i fix it?
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Could you please post the syntax in which your mysql query is asking the database? And, possibly, the layout of the database.
Image Image
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

probably you're trying to add more values than the table has fields.
i.e.

Code: Select all

TABLE `entries` (
  `id` tinyint(3),
  `tag` varchar(10),
  `name` varchar(20)
)
and $query = "INSERT INTO entries VALUES(1,'2','3','4')";
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

...and if you only want to insert into certain columns rather than all columns in your table then

$Query = "INSERT INTO entries (tag,name) values ('2','3')";
Post Reply