Rogue_Phoenix Posted November 28, 2007 Share Posted November 28, 2007 Sorry if this has been asked before but i had a quick look and couldnt see anything. When i have been coding on mysql 4 servers i never had this issue, but since i moved to 5 i have found a problem adding data to the database. Can anyone help. The code im trying to use is as follows: //------------- Fascia additiion ----------------// $add_item= "INSERT INTO fascia (fasciaid, carid, partno, type) VALUES ('', '$_POST[carid]', '$_POST[partfas]', '$_POST[fascia]')"; //execute query mysql_query($add_item,$conn) or die(mysql_error()); //---------- Cellular addition ---------------// $add_cellular= "INSERT INTO cellular VALUES ('', '$_POST[carid]', '$_POST[sot]', '$_POST[relayed]', '$_POST[direct]', '$_POST[additionals]' )"; // execute query mysql_query($add_cellular,$conn) or die(mysql_error()); //--------- Aerial Addition ---------------// $add_aerial= "INSERT INTO aerial VALUES ('', '$_POST[carid]', '$_POST[aerial]', '$_POST[fmmod]' )"; //execute query mysql_query($add_aerial,$conn) or die(mysql_error()); //--------- Harness Addition -------------// $add_harness= "INSERT INTO harness VALUES ('', '$_POST[carid]', '$_POST[rca]', '$_POST[canbus]' )"; //execute query mysql_query($add_harness,$conn) or die(mysql_error()); //--------- Connectivity Addition ---------------// $add_connectivity= "INSERT INTO connectivity VALUES ('', '$_POST[carid]', '$_POST[cdchanger]', '$_POST[ipod]', '$_POST[mostinterface]' )"; //execute query mysql_query($add_connectivity,$conn) or die(mysql_error()); //--------- Speaker Addition ---------------// $add_speaker= "INSERT INTO speakers VALUES ('', '$_POST[carid]', '$_POST[dualdash]', '$_POST[kickpanel]', '$_POST[frontdoor]', '$_POST[reardoor]', '$_POST[rearseatside]', '$_POST[reardeck]', '$_POST[rearside]', '$_POST[rearhatch]', '$_POST[other]' )"; //execute query mysql_query($add_speaker,$conn) or die(mysql_error()); I receive the following error from the database Incorrect integer value: '' for column 'fasciaid' at row 1 Im sure that if i solve the problem on the first one it wil replicate itself on the later queries. Any help would be appreciated. Quote Link to comment Share on other sites More sharing options...
revraz Posted November 28, 2007 Share Posted November 28, 2007 Do you have fasciaid set to Auto Increment in your DB? If so, you can change this line $add_item= "INSERT INTO fascia (fasciaid, carid, partno, type) VALUES ('', '$_POST[carid]', '$_POST[partfas]', '$_POST[fascia]')"; to $add_item= "INSERT INTO fascia (carid, partno, type) VALUES ('$_POST[carid]', '$_POST[partfas]', '$_POST[fascia]')"; If not, you need to set a value for it since its probably set to not null and int Quote Link to comment Share on other sites More sharing options...
Rogue_Phoenix Posted November 28, 2007 Author Share Posted November 28, 2007 Yeah it was an auto incremental field and it has fixed it thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.