SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard silver trophy Jeremy W.'s Avatar
    Join Date
    Jun 2001
    Location
    Toronto, Canada
    Posts
    9,121
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    ergh @ INSERT (asp)

    Getting a Syntax error in INSERT INTO statement...

    Code:
    <%
    	username=request.form("username")
    	password=request.form("password")
    	password1=request.form("password1")
    	level=request.form("level")
    	if not password=password1 then
    		response.redirect("adduser.asp?error=passwords do not match")
    	else
    		Con.Execute("INSERT INTO users(username,password,level) values('" & username & "','" & password & "'," & level)
    	end if
    	response.redirect("index.asp")
    %>
    SVP Marketing, SoCast SRM
    Personal blog: Strategerize
    Twitter: @jeremywright

  2. #2
    code addict Abstraction's Avatar
    Join Date
    Apr 2001
    Location
    Des Moines, IA
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Con.Execute("INSERT INTO users(username,password,level) values('" & username & "','" & password & "'," & level))
    Last edited by Abstraction; Aug 1, 2001 at 14:58.

  3. #3
    SitePoint Wizard
    Join Date
    Jan 2001
    Location
    Milton Keynes, UK
    Posts
    1,011
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What Abstraction said plus a couple more bits.

    Con.Execute("INSERT INTO users(username,password,level) values('" & username & "','" & password & "'," & level & ")")

    coco,
    It's often easier to find sql errors by assigning the sql string to a variable and then Response.Write it so you can test it outside of ASP.

  4. #4
    Just Blow It bronze trophy
    DaveMaxwell's Avatar
    Join Date
    Nov 1999
    Location
    Mechanicsburg, PA
    Posts
    7,265
    Mentioned
    115 Post(s)
    Tagged
    1 Thread(s)
    The overall syntax looked ok to me, but password is usually a reserved word. That could be causing you a problem....

    You can also do a response.write of the SQL being executed to ensure that what you think you're executing and what you are actually doing is one and the same...
    Dave Maxwell - Manage Your Site Team Leader
    My favorite YouTube Video! | Star Wars, Dr Suess Style
    Learn how to be ready for The Forums' Move to Discourse


Bookmarks

Posting Permissions

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