LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This 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.

Notices


Reply
  Search this Thread
Old 07-15-2006, 11:09 AM   #16
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33

Sorry, I really don't understand what you're trying to do. There's no field named "activation" in that table, so you can't assign a value to a field of that name.
"id" is still not set to be incremented automatically, otherwise it would say so in the "extras" column of the table description. You can use an "ALTER TABLE" statement similar to the one above to change that.
 
Old 07-16-2006, 09:05 AM   #17
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
I seriously promise i will study a SQL guide soon , now i only need to auto_increment the id number for new user registred .... How would you do it ???
 
Old 07-16-2006, 09:51 AM   #18
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Quote:
Originally Posted by gabsik
How would you do it ???
I thought this was what I explained all the time. Try the following command:
Code:
ALTER TABLE jos_users MODIFY id MEDIUMINT NOT NULL AUTO_INCREMENT;
Invoke "DESCRIBE jos_users;", it will hopefully show up with an auto_increment flag for the column 'id'. Then you can use the following command to insert a new row which will get an 'id' automatically:
Code:
INSERT INTO jos_users (name) VALUES ('John');
 
Old 07-16-2006, 12:48 PM   #19
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
First command
Code:
mysql> ALTER TABLE jos_users MODIFY id MEDIUMINT NOT NULL AUTO_INCREMENT;
Query OK, 3 rows affected (0.01 sec)
Records: 3  Duplicates: 0  Warnings: 0
DESCRIBE jos_users;
Code:
+-----------------------+-----------------------+------+-----+---------------------+----------------+
| Field                 | Type                  | Null | Key | Default             | Extra          |
+-----------------------+-----------------------+------+-----+---------------------+----------------+
| id                    | mediumint(9)          |      | PRI | NULL                | auto_increment
last command
Code:
mysql> INSERT INTO jos_users (name) VALUES ('ciccio');
Query OK, 1 row affected (0.00 sec)
results:
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','ciccio','ciccio@yahoo.it','27b4b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-16 19:41:51','937099cfec294262792a285909b41725')
 
Old 07-16-2006, 04:23 PM   #20
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Code:
INSERT INTO jost_users('id','name','username','email','password','usertype','block','gid','registerDate','activation')VALUES('0','ciccio','ciccio@yahoo.it','27b4b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-16 19:41:51','937099cfec294262792a285909b41725')
Where does that command come from? As the error messages indicates, there's no column 'activation', so you won't be able to insert any values into it. There wasn't such a column in your first post, so I guess you know how to change the program that issues this SQL statement. And when you're at it, remove the 'id' part from the statement (and the corresponding '0').
 
Old 07-16-2006, 11:40 PM   #21
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
What command do you mean?
anyway the sequence of commands is :
1
Code:
mysql> ALTER TABLE jos_users MODIFY id MEDIUMINT NOT NULL AUTO_INCREMENT;
2
Code:
INSERT INTO jos_users('id','name','username','email','password','usertype','block','gid','registerDate','activation')VALUES('0','ciccio','ciccio@yahoo.it','27b4b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-16 19:41:51','937099cfec294262792a285909b41725')
Quote:
And when you're at it, remove the 'id' part from the statement (and the corresponding '0').
This means i have to remove id and value 0 from the 2 command , right ?
So it looks like
Code:
INSERT INTO jos_users('name','username','email','password','usertype','block','gid','registerDate','activation')VALUES('ciccio','ciccio@yahoo.it','27b4b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-16 19:41:51','937099cfec294262792a285909b41725')

Last edited by gabsik; 07-16-2006 at 11:41 PM.
 
Old 07-16-2006, 11:50 PM   #22
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
That's what i did:
Code:
mysql> ALTER TABLE jos_users MODIFY id MEDIUMINT NOT NULL AUTO_INCREMENT;
Query OK, 4 rows affected (0.02 sec)
Records: 4  Duplicates: 0  Warnings: 0

mysql> INSERT INTO jos_users('name','username','email','password','usertype','block','gid','registerDate','activation')VALUES('ciccio','ciccio@yahoo.it','27b4b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-16 19:41:51','937099cfec294262792a285909b41725')
    ->
It doesn't look it worked .... i must be stupid !

Last edited by gabsik; 07-17-2006 at 02:27 AM.
 
Old 07-17-2006, 04:55 PM   #23
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Quote:
Originally Posted by gabsik
What command do you mean?
The command that I quoted in my previous post.
Quote:
So it looks like
Code:
INSERT INTO jos_users('name','username','email','password','usertype','block','gid','registerDate','activation')VALUES('ciccio','ciccio@yahoo.it','27b4b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-16 19:41:51','937099cfec294262792a285909b41725')
There's still a field named "activation" here. You can't insert a field that doesn't exist in your table. Moreover, the values you're trying to insert don't seem to fit the field names you specify:
name - ciccio
username - ciccio@yahoo.it (?)
email - 27b4b5b01b0d1fcab2046369720ff75e
password -
usertype - 1
block - 18
gid - 2006-07-16 19:41:51
registerDate - 937099cfec294262792a285909b41725
activation (!) -
 
Old 07-17-2006, 08:46 PM   #24
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
I'm messing things up , look this code .....
Code:
mysql> INSERT INTO jos_users('name','username','email','password','usertype','block','gid','registerDate')VALUES('ciccio','ciccio','ciccio@yahoo.it','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','
mysql> INSERT INTO jos_users('name','username','email','password','usertype','block','gid','registerDate')VALUES('ciccio','ciccio','ciccio@yahoo.it','27b4b5b01b0d1fcab2046369720ff75e','','1','18','2006-07-1804:55:00','51805edae6e5131c6f6d7941e9add048')
.... if names and VALUES fit togheter !!!
Do they have to be related to an already registred user ? ... a fake one ?
It says it's wrong here:
Quote:
Check the manual that corresponds to your MySQL server version for the right syntax to use near ''name','username','email','password','usertype','block','gid','
I registred to my site using the above username pass ecc i have copied them from the error window, give it a try ... https://www.gabrix.ath.cx

Last edited by gabsik; 07-17-2006 at 10:07 PM.
 
Old 07-18-2006, 03:59 AM   #25
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
No, they don't fit. There are 8 field names and 9 values. And the error message probably stems from a missing semicolon before "DESCRIBE jos_users;". In principle, there's no restriction on the data you may enter, it'll always create a new row in your table. But if you want to use this for registration data for your website, you should probably make sure that user names are unique.
 
Old 07-18-2006, 01:24 PM   #26
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
Quote:
Originally Posted by spirit receiver
No, they don't fit. There are 8 field names and 9 values. And the error message probably stems from a missing semicolon before "DESCRIBE jos_users;". In principle, there's no restriction on the data you may enter, it'll always create a new row in your table. But if you want to use this for registration data for your website, you should probably make sure that user names are unique.
You are such a SQL expert!
My site is nearly ready,the only problem is users cannot register.
After the
Code:
mysql> ALTER TABLE jos_users MODIFY id MEDIUMINT NOT NULL AUTO_INCREMENT;
command,how would you arrange names and their values for new users ?How can i guess values like encripted password,like gid,usertype,block (???)What are they?A good link?,please help ,let's go over this post otherways i don't know when it will ends if ......
Code:
mysql> INSERT INTO jos_users('name','username','email','password','usertype','block','gid','registerDate')VALUES('ciccio','ciccio','ciccio@yahoo.it','27b4b5b01b0d1fcab2046369720ff75e','1','18','51805edae6e5131c6f6d7941e9add048','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 ''name','username','email','password','usertype','block','gid','

Last edited by gabsik; 07-18-2006 at 01:53 PM.
 
Old 07-18-2006, 03:01 PM   #27
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Quote:
Originally Posted by gabsik
You are such a SQL expert!
I'm certainly not. But your last SQL statement is obviously incomplete again, it's missing a closing bracket and a semicolon at least, and the 'registerDate' doesn't look like a valid 'datetime' to me. I advise you to consult the mysql reference manual.
 
Old 07-18-2006, 06:34 PM   #28
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
Well it does look to me you know lots of SQL! Now
Quote:
I'm certainly not. But your last SQL statement is obviously incomplete again, it's missing a closing bracket and a semicolon at least, and the 'registerDate' doesn't look like a valid 'datetime' to me. I advise you to consult the mysql reference manual.
apart bracket and semicolon and datetimes i need to see the way to do this query could someone just quote this query ... Grrrr !!!!
For sure you can't say i'm not making any effort to resolve this problem !!!

Last edited by gabsik; 07-18-2006 at 06:35 PM.
 
Old 07-19-2006, 01:49 AM   #29
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 17,863

Rep: Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598Reputation: 2598
As spirit_receiver was trying to point out :
1. each separate SQL cmd must end with a semi-colon ie ';'
2. as per prev page, your table does NOT have a column called 'activation', so you CANNOT try to put a value in it.
Maybe you meant 'user_active' ?
HTH
 
Old 07-19-2006, 02:58 AM   #30
gabsik
Member
 
Registered: Dec 2005
Location: This planet
Distribution: Debian,Xubuntu
Posts: 567

Original Poster
Rep: Reputation: 30
Well ....

Is possible to see how you do it ????
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL query performance smaida Programming 6 06-08-2005 09:22 AM
Query tool for MS-SQL server dunric Linux - Software 0 11-14-2004 11:39 AM
SQL query help pls. vickr1z Programming 8 10-18-2004 11:25 PM
Massive SQL Query patpawlowski Programming 7 03-05-2004 04:24 PM
SQL Query question oulevon Programming 7 01-16-2004 01:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration