MySQL Using Auto_Increment not Auto Anything... Grrrr

2012-03-17  Source: Original Site  Category:MySQL  Views:0 


I created a database and created a table with the following columns...

mysql> CREATE TABLE contactForm (name VARCHAR(40),email VARCHAR(60),phone VARCHA
R(25),address VARCHAR(80),city VARCHAR(30),state VARCHAR (20),zip VARCHAR(15),co
mment TEXT,id int auto_increment not null,primary key (id));
Query OK, 0 rows affected (0.24 sec)

I inserted my first record with a value for each column...

mysql> insert into contactform
-> values ('Colby Callahan','[email protected]','541-531-8815','835 Alde
r Creek Drive, Ste A','Medford','OR','97504','This is part of my comment!',1);
Query OK, 1 row affected (0.03 sec)

Everything went good. Now I want to enter records without having to enter an id each time. I figured the id value should automatically be inserted into the appropriate column, but instead it seems like I have to manually enter an id each time...

mysql> insert into contact form
-> values ('tom','[email protected]','555-555-5555','555 west st','cp','OR','97555','c
omments are lame');

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'form
values ('tom','[email protected]','555-555-5555','555 west st','cp','OR','97555','com' at
line 1

Can someone explain how to get a column to automatically insert a value and automatically increase when I enter record information?

MySQL Experience = 1 day......

Related articles
  • MySQL Using Auto_Increment not Auto Anything... Grrrr 2012-03-17

    I created a database and created a table with the following columns... mysql> CREATE TABLE contactForm (name VARCHAR(40),email VARCHAR(60),phone VARCHA R(25),address VARCHAR(80),city VARCHAR(30),state VARCHAR (20),zip VARCHAR(15),co mment TEXT,id

  • MySQL Does AUTO_INCREMENT not work? 2012-07-24

    I created a table using the MySQL Query GUI using the command CREATE TABLE table2( lineID int NOT NULL AUTO_INCREMENT, name char(25) NOT NULL, addr char(25) NOT NULL); However when I use in INSERT statement to add data I get an error message if I don

  • MySQL Using AUTO_INCREMENT in DB synchronization 2015-04-06

    AUTO_INCREMENT is the standard way for Mysql applications to generate unique key values. MySQL 5 introduces a couple of server variables, auto_increment_increment and auto_increment_offset, which make it possible to keep using AUTO_INCREMENT columns

  • MySQL use of 'not' 2012-09-30

    I have this query: INSERT INTO LIFTLINE( `NAME` , `ATTENTION` , `ADDRESS` , `CITY` , `STATE` , `ZIP_CODE` , `ZIP+4` , `CR` , `DP` , `RC` ) SELECT `NAME` , `ATTENTION` , `ADDRESS` , `CITY` , `STATE` , `ZIP_CODE` , `ZIP+4` , `CR` , `DP` , `RC` FROM mbr

  • MySQL use of NOT IN 2012-08-20

    its been a long while since i have used sql and i need some help i have a table machine_no, shot_no , time 1 34 2009-02-17 02:35:43 2 15 2009-02-17 02:50:43 3 19 2009-02-17 02:54:43 what i am trying to do is get all the max time (last time for each m

  • MySQL USE is not allowed in stored procedures 2013-04-27

    I'm trying to write a stored procedure that will select from different local databases. I need to read a value from a table and use that value to determine which database to read from. I want to construct the database name dynamically: SET dbname = C

  • MySQL Using "AND NOT" and "OR NOT" 2013-05-11

    When composing a WHERE statement is there any reason why the following syntax should not be used? WHERE (NOT (CONDITION 1) AND NOT(CONDITION 2)) OR NOT(CONDITION 3) The software that I am working with, should allow clients to change from an "equals"

  • mysql innodb did not using index well 2014-04-27

    mysql innodb did not using index well select @@version; returns: 5.1.44-community CREATE TABLE `z_temp` ( `idz_temp` int(10) unsigned NOT NULL AUTO_INCREMENT, `strdt` varchar(45) DEFAULT '', `dt` datetime DEFAULT NULL, `bz` varchar(45) DEFAULT 'aaa',

  • /etc/mysql/my.cnf not used? 2014-01-01

    Hello, I have hopefully related problems with a binary install on Ubuntu following instructions here: After I start MySQL with: /usr/local/mysql/bin/mysqld_safe --user=mysql & I can connect

  • MySQL Query to select all fields using AUTO_INCREMENT, and then delete all data with a value of 0? 2013-08-08

    Got a database with lots of tables using AUTO_INCREMENT quite a bit. Around a week ago a restore was done on this database from a backup made with compatibility mode turned on which removed the AUTO_INCREMENT value from the SQL. Problem I have now is

  • MySQL: advanced auto_increment 2012-03-12

    Here's a MySQL question that I am sure others have faced: I have a small number of rows in a table, say around 100, but records come and go continuously, so there is constant deletion of old records and insertion of new ones. I could use auto_increme

  • MySQL USE after DROP and CREATE (script in Query Browser) 2012-07-24

    all, I hope this belongs here and not in Query Browser forum. I'm writing a simple script that creates the database and tables: ------------------------------------ DROP DATABASE IF EXISTS mydb; CREATE DATABASE mydb CHARACTER SET utf8 COLLATE utf8_un

  • MysqlCon object GetError() not returning anything 2012-10-17

    I'm debugging one of my apps which uses mysql++ library, I have queries failing, but GetError() is not returning anything, making this very hard to debug. Why would it not return anything?

  • MySQL using trigger to populate unique column does work 2013-03-15

    Well, I am used to oracle and having a convienient way of having *two* columns within a single table be unique and having the values updated by oracle. I realize that I can do what I want using 'auto_increment' on one column, but for the life of me I

  • MySQL Replication Master Not Logging Changes In Binlog? 2013-08-13

    MySQL Replication Master Not Logging Changes In Binlog? The following setup is on MySQL 4.0.16 on Debian LINUX. It appears as if my replication master is not logging changes to any databases. My my.cnf is as follows: server-id = 154 log-bin = /var/lo

  • Ubuntu multple issues - Grub timoout not working, services not auto starting 2013-12-24

    Been having a frustrating time the last while with Ubuntu Karmic 64-bit (fully updated) on 2 systems. Common to both: CPU - AMD Athalon II quadcore MOBO - Gigabyte MA785GMT-UD2H Differences: on Atilla: ------------ RAM - 4 gig Dual Boot _XP and Ubunt

  • MySQL using ' in the SQL query without using parameters 2014-01-21

    Im developing a program in Realbasic and with the supplied MySQL plugin, parameters are not supported. Is there someway of using a "tag" or anything in an insert query, if the inserted text contains the ' character To give an example of what i mean S

  • MySQL Using Windows logon username and password 2014-03-07

    I know this has probably been asked. But I searched the forum and the site for "Windows Logon" and did not find anything applicable. Is there a way to have either mysql,php or Window XP use the users windows username and password as the username and

  • Ubuntu Snort not detecting anything 2014-06-22

    I'm not sure if I'm posting in the right forum or not. I haven't been on Ubuntu Forums in a while and I thought they used to have an "other operating systems" category. I've asked this question at Debian User Forums, but no one seems to have any idea

  • insert into mysql using php from a text file 2014-10-10

    all i am trying to insert data from a text file to the mysql db it is working for the first record, not inserting later records how can do it from the following code, modify it for me //insert into mysql using php from a text file <?php $conn=mysq