MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old February 8th, 2003, 02:19 PM
tracis tracis is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 tracis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unexpected number of users with MySQL

I have created a page called "add user".
The code uses ASP and a MySQL database.
This code works, however, am unable to add more users. It has only added one; "test" user with a password.

How can I get it to add more users?
Attached Files
File Type: txt adduser.txt (1,010 Bytes, 255 views)

Reply With Quote
  #2  
Old February 9th, 2003, 02:32 PM
praveen praveen is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Location: india
Posts: 7 praveen User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 13 sec
Reputation Power: 0
Database structure needed

You might have included your database structure also. problem may be with your table design.

Reply With Quote
  #3  
Old February 11th, 2003, 07:18 AM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
First, check if you table is correctly design as praveen said. Try this structure:

create table logins (
login_id int(11) not null auto_increment,
login_user varchar(20) not null,
login_pass varchar(20) not null,
primary key(login_id));

And I have modified a few things in you file. It's attached and see if it works.
Attached Files
File Type: txt adduser.txt (1.1 KB, 241 views)
__________________
Regards,
Ramiro Varandas Jr.

Reply With Quote
  #4  
Old February 11th, 2003, 07:34 AM
tracis tracis is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 tracis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Did not work

That did not work.
It's hopeless.

Reply With Quote
  #5  
Old February 11th, 2003, 09:29 AM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
By the way, are you including the adovbs.inc file?!
I'm attaching it here. This file is necessary for database connection in ASP.
Attached Files
File Type: zip adovbs.zip (2.1 KB, 276 views)

Reply With Quote
  #6  
Old February 11th, 2003, 09:36 AM
tracis tracis is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 tracis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy New error

Now i get this error page:


Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[TCX][MyODBC]Table 'aox.logins' doesn't exist
/AOXfiles/adduser.asp, line 27

and line 27 is
adoConn.Execute(SQL)

Reply With Quote
  #7  
Old February 11th, 2003, 12:38 PM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
Is the name of your table in capitalize letters, like Logins, because MySQL is case sensitive for table and database names.

Reply With Quote
  #8  
Old February 11th, 2003, 12:43 PM
tracis tracis is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 tracis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
No. Its in there like

"logins"

I deleted the one I was using and put yours in there. Not working.?

But its a table, and not a database, so its sitting under "smartlogins" database.

Reply With Quote
  #9  
Old February 11th, 2003, 01:16 PM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
Can you attach the files with the codes? So that I can look into for search the error.

Reply With Quote
  #10  
Old February 11th, 2003, 01:24 PM
tracis tracis is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 tracis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Very grateful

Glad you have the time to look at it.

See attached.
Attached Files
File Type: txt adduser.txt (1.1 KB, 218 views)

Last edited by tracis : February 11th, 2003 at 01:27 PM.

Reply With Quote
  #11  
Old February 11th, 2003, 01:29 PM
tracis tracis is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 tracis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
More details

I didnt know if you knew this or not:

Im using MySQL as the database server
ASP for language

and DSN

Thanks
Traci

Reply With Quote
  #12  
Old February 12th, 2003, 07:38 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 7
Send a message via MSN to aspnewbie
There appears to be an error in the code:

Code:

SQL = "INSERT INTO logins (user_name, password) VALUES 
('" & strUserName & "',PASSWORD('" & strPassWord & "'))"	


It should read:

Code:

SQL = "INSERT INTO logins (user_name, password) VALUES
 ('" & strUserName & "','" & strPassWord & "')"


Also, I don't know about mysql, but some dbs (Access for example) have problems with fieldnames called password - it's could be a reserved term.

If you changed your database structure to the one listed earlier then the insert would be:

Code:

SQL = "INSERT INTO logins (user_name, login_pass) VALUES
 ('" & strUserName & "','" & strPassWord & "')"


Also, your form action says "/adduser.asp". Why not make it "adduser.asp" or Request.ServerVariables("SCRIPT_NAME")?

Last edited by aspnewbie : February 12th, 2003 at 07:52 PM.

Reply With Quote
  #13  
Old February 12th, 2003, 08:01 PM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
The SQL is correct, the function that aspnewbie took off is the PASSWORD() function. This encrypts the password so that no one can read it.

MySQL doesn't have problems with fields named password.
I do think that the problem could be in a file that is included.
Tracis, can you post in a zip file the files you're using (like the ones you're including...) so that I can check it out, because the last time you have attached the code that you've attached before.

Reply With Quote
  #14  
Old February 12th, 2003, 08:05 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 7
Send a message via MSN to aspnewbie
Did not know that. Thanks Ramz. Learn something new everyday. Disregard my suggestions.

Is the Password function something you created or native to mysql?


Last edited by aspnewbie : February 12th, 2003 at 08:12 PM.

Reply With Quote
  #15  
Old February 12th, 2003, 08:27 PM
tracis tracis is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 tracis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Talking Files you requested

Attached are the files you have requested. Thank you very much for your help.
Attached Files
File Type: zip ramz.zip (4.5 KB, 224 views)

Reply With Quote
  #16  
Old February 12th, 2003, 08:28 PM
ramz ramz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: Juiz de Fora - MG- Brazil
Posts: 93 ramz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via ICQ to ramz Send a message via MSN to ramz
Is MySQL and it's irreversible. It's generated like a MD5 hash, so it's very secure. To check a user login with that, you should use:

SELECT * FROM user WHERE user_field = '" & formUser & "' AND pass_field = PASSWORD('" & formPass & "')

Reply With Quote
  #17  
Old February 12th, 2003, 08:32 PM
tracis tracis is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 11 tracis User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
User permissions

Was I suppose to create user permissions?

grant select, insert, update
on logins,
to someone@localhost identified by 'password';

I did not do that in the database.

-Traci

Reply With Quote
  #18  
Old February 12th, 2003, 08:40 PM