View Full Version : ASP with MYSQL

12-16-2007, 12:00 PM

could anyone tell me whats wrong with this code.


Set my_conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")

my_conn.Open "DSN=mysql_dsn"

DIM mySQL, user, pass, submit, delete
user = request.form("username")
pass = request.form("userpass")
submit = request.form("submit")
delete = request.form("delete")

if user<>"" and pass<>"" then
call checkUser()
end if

sub checkUser()
mySQL = "SELECT userName From customers WHERE userName='"&user"';"
Set rs = my_conn.Execute(SQL)
if rs("userName")=user then
Reponse.Write("Found User "&user)
end if
end sub

Set rs = Nothing
Set my_conn = Nothing

12-17-2007, 04:44 PM
No - you tell us what's wrong with it - we then suggest ways you can fix it. Are you getting an error message? What does it say?

12-18-2007, 07:01 PM
How about here:

mySQL = "SELECT userName From customers WHERE userName='"&user"';"

Should it not be:

mySQL = "SELECT userName From customers WHERE userName='" & user & "';"

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum