Mysql auto_increment

Discussion in 'Server Operation' started by gabriele, Jul 19, 2006.

  1. gabriele

    gabriele New Member

    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
    Code:
    mosuser::store failed<br/>Unknown column 'activation' in 'field list' SQL=INSERT INTO jost_users(
    'id','name','username','email','password','usertype','block','gid','registerDate','activation')VALUES('0','maria','[email protected]','27b4b5b01b0d1fcab2046369720ff75e','','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
    Code:
    mysql> ALTER TABLE jos_users MODIFY id MEDIUMINT NOT NULL AUTO_INCREMENT;
    
    This is the second query
    Code:
    mysql> INSERT INTO jos_users('name','username','email','password','usertype','block','gid','registerDate')VALUES('maria','maria','[email protected]','27b4b5b01b0d1fcab2046369720ff75e','','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!
     
    Last edited: Jul 19, 2006
  2. falko

    falko Super Moderator Howtoforge Staff

    You must change

    Code:
    INSERT INTO jos_users('name','username','email','password','usertype','block','gid','registerDate')VALUES('maria','maria','[email protected]','27b4b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-1804:55:00','51805edae6e5131c6f6d7941e9add048')
    
    to

    Code:
    INSERT INTO jos_users(name,username,email,password,usertype,block,gid,registerDate) VALUES('maria','maria','[email protected]','27b4b5b01b0d1fcab2046369720ff75e','','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.
     
  3. sjau

    sjau Local Meanie Moderator

    Why not just reinstalling joomla in a different db or with a different prefix and look at the differences?
     
  4. gabriele

    gabriele New Member

    Code:
    mysql> INSERT INTO jos_users(name,username,email,password,usertype,block,gid,registerDate) VALUES('maria','maria','[email protected]','27b4b5b01b0d1fcab2046369720ff75e','','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 ...
    Code:
    mysql> INSERT INTO jos_users(name,username,email,password,usertype,block,gid,registerDate)VALUES('maria','maria','[email protected]','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.
     
    Last edited: Jul 20, 2006
  5. gabriele

    gabriele New Member

    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!
     
    Last edited: Jul 20, 2006
  6. falko

    falko Super Moderator Howtoforge Staff

    I don't know Joomla, so I guess you have to review the sources to see where you can change what...
     
  7. gabriele

    gabriele New Member

    That's the table jos_users.It has the auto_increment set:
    Code:
    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:
    Code:
    mysql> INSERT INTO jos_users(name,username,email,password,usertype,block,gid,registerDate)VALUES('ciro','ciro','[email protected]','949d68ce38121db707017970fc91711a','','1','18','2006-07-19 10:21:07');
    Query OK, 1 row affected (0.00 sec)
    But:
    Code:
    mosuser::store failed<br/>Unknown column 'activation' in 'field list' SQL=INSERT INTO jos_users('id','name','username'.'email','password','usertype','block','gid','registerDate','activation' )VALUES ('0','angela','angela','[email protected]','36388794be2cf5f298978498ff3c64a2','','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 !!!!
     
  8. falko

    falko Super Moderator Howtoforge Staff

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

Share This Page