tags:

views:

218

answers:

3

hi every one i have a problem in mysql

my table is

          CREATE TABLE IF NOT EXISTS `contactform` (
                  `contact_id` int(11) NOT NULL AUTO_INCREMENT,
                    `first_name` varchar(50) NOT NULL,
                  `addition` varchar(50) NOT NULL,
                     `surname` varchar(50) NOT NULL,
                  `Address` varchar(200) NOT NULL,
                   `postalcode` varchar(20) NOT NULL,
                        `city` varchar(50) NOT NULL,
                      `phone` varchar(20) NOT NULL,
                      `emailaddress` varchar(30) NOT NULL,
                           `dob` varchar(50) NOT NULL,
                               `howtoknow` varchar(50) NOT NULL,
                          `othersource` varchar(50) NOT NULL,
                             `orientationsession` varchar(20) NOT NULL,
                               `othersession` varchar(20) NOT NULL,
                                  `organisation` int(11) NOT NULL,
                                      `newsletter` int(2) NOT NULL,
                                      `iscomplete` int(11) NOT NULL,
                          `registrationdate` date NOT NULL,
                            PRIMARY KEY (`contact_id`)
                     ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=39 ;



             mysql>insert into contactform values('','abhi','sir','shukla','vbxcvb','342342','asdfasd','234234234','[email protected]','1999/5/16','via vrienden of familie','','19','20','6','1','1','2010-03-29')

i get following error. #1366 - Incorrect integer value: '' for column 'contact_id' at row 1

this query work fine on my local machine but give error on server

+1  A: 

'' is not an integer, is it?

Also, that is some seriously weird indentation.

Coronatus
but it work fine on local
rajanikant
It works fine when you have a MySQL-server without propper configuration. See the SQL MODE: http://dev.mysql.com/doc/refman/5.1/en/server-sql-mode.html A good configuration will produce errors when you do something wrong. Inserting a string into a integer field, is wrong.
Frank Heikens
+1  A: 

Try using NULL instead of '' for contact_id in

insert into contactform values(NULL,......
codaddict
thanks it solve my problem
rajanikant
@Rajanikant: You are welcome :). Also since you are new to Stack overflow, I would like to inform you that you can accept an answer that helped you the most by checking the tick mark next to the Answer.
codaddict
A: 

'' is an empty string, you want a integer, but this integer is created by the database. Drop the columnname in the INSERT and don't insert any value.

Frank Heikens