Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Of course it is. You must either provide an id that's not already present or provide none at all and define your table in such a way that id will be incremented automatically. Have a look at the database documentation and search for "increment".
When multiple servers are configured as replication masters, special steps must be taken to prevent key collisions when using AUTO_INCREMENT columns, otherwise multiple masters may attempt to use the same AUTO_INCREMENT value when inserting rows.
and that's the right documentation where i have to look for :
How to assign the AUTO_INCREMENT attribute to a column: Section 13.1.5, “CREATE TABLE Syntax”, and Section 13.1.2, “ALTER TABLE Syntax”.
Looks fine to me, why don't you just try it? You'll see that 'admin' automatically gets an id, and if you insert a new row, it'll get another id. I don't know anything about replication, but I guess it's nothing you should do unless you've got some experience with database management.
I'm sorry but it is still giving me the error i missed something sure ... !
store:mosuser::store failed <br/>Duplicate entry '0' for key 1 SQL=INSERT INTO jos_users('id','name','username','email','password','usertype','gid','registerDate')
VALUES('0','gabrix','smith','email@example.com', ... ecc. ... )
Anyway,i don't think is necessary to create a new table.If you see the error message it says of a table jos_users and maybe i have to auto_icrement the id and modify that table ... but how ??????????????
Why would you want to create a new table? If you want a column to be incremented automatically, you'll have to specify that during creation of the table or in an "ALTER TABLE" statement. For example, if you had forgotten "AUTO_INCREMENT" in that "CREATE TABLE users" statement above, then you could add it later using
ALTER TABLE users MODIFY id MEDIUMINT NOT NULL AUTO_INCREMENT;
And if the AUTO_INCREMENT property is set for column 'id' in table 'jos_users' already, you can use the following command to add a new row, which will be assigned a new id automatically:
INSERT INTO jos_users('name','username','email','password','usertype','gid','registerDate')
VALUES('gabrix','smith','firstname.lastname@example.org', ... ecc. ... );
OK, so after the first statement from your last post, the 'id' column will be incremented automatically. Try "DESCRIBE users;", it will also give you that information.
But then, I think the error message you just gave doesn't belong to the INSERT statement above, as it complains about a nonexistent column named "activation" which didn't appear in that statement. And have a look at the INSERT statement from my previous post: If you want the value of 'id' to be inserted automatically, you must not specify a value in the statement. So the list of column names begins with 'name' instead of 'id':