rgoogs21 Posted April 26, 2006 Share Posted April 26, 2006 Hello I am new here and a little new to PHP and MySQL also. I have a site that was made with php and a mysql database and was recently moved to a new hosting service. Now whenever I add data to the database through my site I can do it the first time but after that I get this error[code]Error in SQL query! MySQL: Duplicate entry '0' for key 1[/code]I figured out it has to do with the ID it gives each piece in the table it is in but I dont know how to set it to start at the number it left off on when it was at the old hosting. Any help will be greatly appreciated.Ryan Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 26, 2006 Share Posted April 26, 2006 Sounds like when the database was ported over to the new provider and created the primary key wasn't set to auto increment. Just to confirm this, can you export the table in question and show it here please? I'm at work at the moment and can't remember how to make the key set to auto increment - I'm sure someone here will be able to help. Quote Link to comment Share on other sites More sharing options...
rgoogs21 Posted April 26, 2006 Author Share Posted April 26, 2006 Well it happens to be every table that I use let me get a table for you, I think this is what you want[code]Field Type Null Defaultid_program smallint(6) No 0id_user smallint(6) No 0nazwa varchar(50) No url varchar(70) No opis text No mail varchar(30) No forum varchar(70) No feedback varchar(100) No telefon varchar(20) No icq varchar(30) No data date No 0000-00-00status char(1) No rating float No 0min_payout varchar(100) No min_deposit varchar(100) No time_payout varchar(150) No referral varchar(20) No total smallint(6) No 0comment text No exclusive char(1) No premium char(1) No blacklist char(1) No stormpay char(1) No egold char(1) No ebullion char(1) No goldmoney char(1) No netpay char(1) No intgold char(1) No moneybookers char(1) No alertpay char(1) No emo char(1) No paypal char(1) No other char(1) No uniclear char(1) No premium_no tinyint(4) No 0[/code]That is a table where people add their program to the database. I currently have around 21 and now it starts with the id_program of 0 and never movesWow I think I just figured it out. Thank you so much for pointing me in the right direction. If I need any more help I will be back. Thanks again.Ryan 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.