Query SQL error
On my site when a user tries to register he gets this error:
Quote:
|
I guess that "id" has to be unique in that table, and there exists already a row with id=0.
|
Ok!
Is anyway to get over this error ... ??? |
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".
|
that's what i was after isn't it ?
Quote:
Quote:
It's my first sql .... it looks like there is lot of writing down ! http://dev.mysql.com/doc/refman/5.0/...ate-table.html don't know where to start ... |
Quote:
and than add this tags to SQL: Quote:
Is it correct ???????????????????????????????????????????????????????????????????????????????????????? |
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 cannot f***k up with SQL if something goes wrong .... that's how i did :
Quote:
|
At least I can't see any problem with that.
|
I'm sorry but it is still giving me the error i missed something sure ... !
Quote:
|
what's the id number i have to use for auto_increment?
Code:
ALTER TABLE jos_users AUTO_INCREMENT = 1 |
Quote:
Code:
ALTER TABLE users MODIFY id MEDIUMINT NOT NULL AUTO_INCREMENT; Code:
INSERT INTO jos_users('name','username','email','password','usertype','gid','registerDate') |
Quote:
Quote:
Quote:
|
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': Code:
INSERT INTO jos_users('name','username',...); |
Step by step ...
Code:
mysql> DESCRIBE jos_users; Once in the proper database i should launch: Code:
INSERT INTO jos_users('name','username','email','password','usertype','gid','registerDate') Code:
"activation" Code:
INSERT INTO jos_users('name','username','email','password','usertype','gid','registerDate','activation') Code:
VALUES('gabrix','smith','smith@yahoo.it', ... ecc. ... ); Should it be related to a real user already registred ?, to a fake one ? It's not necessary at ALL ???????????? |
All times are GMT -5. The time now is 10:27 AM. |