Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: ASP with MYSQL

  1. #1
    New Coder
    Join Date
    Dec 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ASP with MYSQL

    heya,

    could anyone tell me whats wrong with this code.

    thanks

    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
    %>

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    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?

  • #3
    New Coder
    Join Date
    Dec 2007
    Location
    UK
    Posts
    41
    Thanks
    1
    Thanked 7 Times in 7 Posts
    How about here:

    Code:
    mySQL = "SELECT userName From customers WHERE userName='"&user"';"
    Should it not be:


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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •