I have a web form which submits data to a database and works great, but I also want each record to have an id.
I tried adding an auto increment, id to the database through PHP admin but of course when I then try submitting data using the form it dont work nomore. Not sure what I am doing wrong works fine till I try it with the id part added to both the database and form script.
Need some advise on how to go about adding an id to each entery made to the database.
I tried adding the id to the database using this method when creating the table.
CREATE TABLE data (
id int NOT NULL AUTO_INCREMENT,
bike VARCHAR( 30 ) ,
price VARCHAR( 30 ) ,
location VARCHAR( 30 ) ,
details VARCHAR( 90 ) ,
database_filename VARCHAR( 90 ) ,
PRIMARY KEY (id)
I also added the id to the Insert part of my form script like below.
mysql_select_db("johnmev_test") or die(mysql_error());
mysql_query("INSERT INTO `data` (id, bike, price, location, database_filename) VALUES ('NULL', '$bike', '$price', '$location', '$details', '$database_filename')");