|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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? |
|
#2
|
|||
|
|||
|
Database structure needed
You might have included your database structure also. problem may be with your table design.
|
|
#3
|
|||
|
|||
|
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.
__________________
Regards, Ramiro Varandas Jr. |
|
#4
|
|||
|
|||
|
That did not work.
It's hopeless. |
|
#5
|
|||
|
|||
|
By the way, are you including the adovbs.inc file?!
I'm attaching it here. This file is necessary for database connection in ASP. |
|
#6
|
|||
|
|||
|
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) |
|
#7
|
|||
|
|||
|
Is the name of your table in capitalize letters, like Logins, because MySQL is case sensitive for table and database names.
|
|
#8
|
|||
|
|||
|
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. |
|
#9
|
|||
|
|||
|
Can you attach the files with the codes? So that I can look into for search the error.
|
|
#10
|
|||
|
|||
|
Very grateful
Glad you have the time to look at it.
See attached. Last edited by tracis : February 11th, 2003 at 01:27 PM. |
|
#11
|
|||
|
|||
|
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 |
|
#12
|
|||
|
|||
|
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. |
|
#13
|
|||
|
|||
|
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. |
|
#14
|
|||
|
|||
|
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. |
|
#15
|
|||
|
|||
|
Attached are the files you have requested. Thank you very much for your help.
|
|
#16
|
|||
|
|||
|
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 & "') |
|
#17
|
|||
|
|||
|
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 |
|
#18
|
|
|