PDA

View Full Version : Mysql auto_increment


gabriele
19th July 2006, 03:01
I run a site powered by joomla cms on a debian sarge 3.1 2.6 with apache-ssl.After the first user registration Mysql is giving this error after a user registration

mosuser::store failed<br/>Unknown column 'activation' in 'field list' SQL=INSERT INTO jost_users(
'id','name','username','email','password','usertyp e','block','gid','registerDate','activation')VALUE S('0','maria','maria@gabrix.ath.cx','27b4b5b01b0d1 fcab2046369720ff75e','','1','18','2006-07-16 19:41:51','937099cfec294262792a285909b41725')

In a forum i found out remove the id column and the '0' value after i inserted this code

mysql> ALTER TABLE jos_users MODIFY id MEDIUMINT NOT NULL AUTO_INCREMENT;

This is the second query

mysql> INSERT INTO jos_users('name','username','email','password','us ertype','block','gid','registerDate')VALUES('maria ','maria','maria@gabrix.ath.cx','27b4b5b01b0d1fcab 2046369720ff75e','','1','18','2006-07-1804:55:00','51805edae6e5131c6f6d7941e9add048')
-> describe jos_users; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''name','username','email','password','usertype',' block','gid','

What are the proper values i have to insert ?
Do they have to be related to an existent user or i have to register a new user straight into Mysql with the new values?
In this case what values are going to be for 'password','usertype','block','gid' ...

I know nothing of sql i will soon read a guide but now users cannot register to my site,and it's more than 2 weeks i'm after this problem.
I invite you to try register to my site and see the error message from live https://www.gabrix.ath.cx
Thanks!

falko
20th July 2006, 13:26
You must change

INSERT INTO jos_users('name','username','email','password','us ertype','block','gid','registerDate')VALUES('maria ','maria','maria@gabrix.ath.cx','27b4b5b01b0d1fcab 2046369720ff75e','','1','18','2006-07-1804:55:00','51805edae6e5131c6f6d7941e9add048')

to

INSERT INTO jos_users(name,username,email,password,usertype,bl ock,gid,registerDate) VALUES('maria','maria','maria@gabrix.ath.cx','27b4 b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-1804:55:00')

The columns must not have ' signs around them, and in VALUES you have one more value than you have columns, so I removed the last value.

sjau
20th July 2006, 14:05
Why not just reinstalling joomla in a different db or with a different prefix and look at the differences?

gabriele
20th July 2006, 18:38
mysql> INSERT INTO jos_users(name,username,email,password,usertype,bl ock,gid,registerDate) VALUES('maria','maria','maria@gabrix.ath.cx','27b4 b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-1804:55:00')
-> describe jos_users; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'describe jos_users' at line 2

there is a discussion on this at LQforum http://www.linuxquestions.org/questions/showthread.php?t=463251
I have tryied myself with this code and it is gone a bit better but the error message stayied the same when you register at my site https://www.gabrix.ath.cx try yourself ...

mysql> INSERT INTO jos_users(name,username,email,password,usertype,bl ock,gid,registerDate)VALUES('maria','maria','maria @gabrix.ath.cx','949d68ce38121db707017970fc91711a' ,'','1','18','2006-07-19 10:21:07');
Query OK, 1 row affected (0.00 sec)

Your code looks wrong in the registerDate colomn.

gabriele
20th July 2006, 19:48
The news are : with the above code 'Query OK' the user got registred so i guess defintly it is not a mysql problem but joomla.
It's complaining about column 'activation' in ''field list'.
I can delete that column giving a new query with no 'activation' into it,right ?
Or there is an another way ...
The query OK , had no 'activation' in it,so why it's still complaining?????????????
I'm getting confused ....
By the way you can all give it a try https://www.gabrix.ath.cx
This is not an advertisement!

falko
21st July 2006, 14:19
I don't know Joomla, so I guess you have to review the sources to see where you can change what...

gabriele
22nd July 2006, 07:55
That's the table jos_users.It has the auto_increment set:
mysql> describe jos_users;
+-----------------------+-----------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-----------------------+-----------------------+------+-----+---------------------+----------------+
| id | mediumint(9) | | PRI | NULL | auto_increment |

I insert the new coloms and values into it:
mysql> INSERT INTO jos_users(name,username,email,password,usertype,bl ock,gid,registerDate)VALUES('ciro','ciro','ciro@ga brix.ath.cx','949d68ce38121db707017970fc91711a','' ,'1','18','2006-07-19 10:21:07');
Query OK, 1 row affected (0.00 sec)
But:
mosuser::store failed<br/>Unknown column 'activation' in 'field list' SQL=INSERT INTO jos_users('id','name','username'.'email','password ','usertype','block','gid','registerDate','activat ion' )VALUES ('0','angela','angela','angela@yahoo.it','36388794 be2cf5f298978498ff3c64a2','','1','18','2006-07-22 06:40:42','7de918be9fce9e683d16e5eac0a5ce80')
How do i delete that 'activation'?
I have changed values but 'id' and '0' are still there ...
Please help !!!!

falko
23rd July 2006, 23:47
How do i delete that 'activation'?

You can either add a column "activation" to the table, or you change the Joomla sources so that you don't need that column.