ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Ok, I may be doing some thing wrong here. I have 2 tables and one form that inserts to the tables. When i fill in the form the first record gets inserted in to boath tables. but when i try to insert a 2nd record i get a "Duplicate entry '0' for key 1." error
I am using a php page that i developed in Dreamweaver MX. Both of the keys are named the same and are an decimal.
Wen i submit through the web page i get this error:
uplicate entry '0' for key 1
now i noticed using CocaMySQL that the pkey default value for the PKey is 0. If i change it to 1 or i can insert a nother row, then i get the same error message. If i chance it to 2 it will work again but then stops when a nother row is added. I can not change this default field. if i try i dont get an error but it defailst back to 0
MySQL 16:38:03] SHOW INDEX FROM `Venders`
[MySQL 16:38:15] ALTER TABLE `Venders` CHANGE `id` `id` decimal(10,0) UNSIGNED NOT NULL DEFAULT ""
[MySQL 16:38:15] SHOW COLUMNS FROM `Venders`
[MySQL 16:38:15] SHOW INDEX FROM `Venders`
If i change it to Null i get:
[MySQL 16:39:39] ALTER TABLE `Venders` CHANGE `id` `id` decimal(10,0) NOT NULL DEFAULT NULL
[ERROR 16:39:39] Invalid default value for 'id'
Is there some Syntax that i am missing? i am fairly new to SQL in general.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.