Let the id be autoincremental ni the database-schema (would be {value for column a})
. (thats why it's not assigned in the insert-statement.)
Just do like this:
INSERT INTO `table` VALUES({value for column b}, {value for column c})
Here's an example:
DB-Schema:
Name of table:
groovy_machines
Columns:
id (autoincrement, primary key)
name (varchar, name of groovymachine)
color (int, color of groovy machine)
Insertion
INSERT INTO 'groovy_machines' (
'wonderhelicopter',5,
'grasshopperbike', 10,
'dontgemewrongstoppermachine', 12
);
UPDATE: When creating an autoincremental column you must also assign it as a primary key, just as the mysql error states for you.
CREATE TABLE `groovy_machines` (
`id` int( 11 ) NOT NULL AUTO_INCREMENT ,
PRIMARY KEY ( `id` )
)
Your creation of table could look something like this:
CREATE TABLE `table` (
`id` int( 11 ) NOT NULL AUTO_INCREMENT ,
`Nick` CHAR(30),
`Xpos` INT,
`Ypos` INT,
`Punkty` INT,
`Ratuszlvl` INT,
`Koszarylvl` INT,
`Stajnialvl` INT,
`Warsztatlvl` INT,
`Kuznialvl` INT,
`Ryneklvl` INT,
`Tartaklvl` INT,
`Cegielnialvl` INT,
`Hutalvl` INT,
`Zagrodalvl` INT,
`Spichlerzlvl` INT,
`Schoweklvl` INT,
`Murlvl` INT,
`Palaclvl` INT,
`Data` DATE,
`Czas` TIME,
PRIMARY KEY ( `id` )
)