SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem: database function creates empty fields

    Hello,

    I am having problems with the below javascript function that is supposed to be posting the changing values of the variables “name”, “password”, and “email” to an Access database from a form redirect. Problem is, the values are not posting properly. They reach the database, but create empty fields. I get no error messages and am at a loss. Any suggestions on what is wrong with the below code?

    Function createUser(name,pass,email)
    Set DBConn9 = Server.CreateObject("ADODB.Connection")
    DBConn9.Open getDbCon()
    Set oRS9 = DBConn9.Execute("INSERT INTO users (name, pass, email) VALUES ('" & name & "','" & pass & "','" & email & "');")
    if DBConn9.errors.count> 0 then
    for counter = 0 to DBConn9.errors.count
    response.write "Database Error #" & DBConn9.errors(counter).number & " -> " & DBConn9.errors(counter).description & "<br>"
    next
    end if
    set DBConn9 = nothing
    End Function

    Thanks,
    Diggs
    Audio English Lessons Online
    www.english1010.com

  2. #2
    SitePoint Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try putting a response.write "INSERT INTO users (name, pass, email) VALUES ('" & name & "','" & pass & "','" & email & "');" at the start of the function - it sounds like you're not passing what you think you're passing and the errors further up the logic. This will show you the SQL

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Posts
    70
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    THanks for the reply,

    When I put in the response.write at the beginning of the function as you suggest, I get the following showing up on my page:

    INSERT INTO users (name, pass, email) VALUES ('','','');

    They are blank, which I guess explains the empty fields. Sorry, I am new to this. Any ideas what the problem may be?

    Thanks,
    Diggs
    Audio English Lessons Online
    www.english1010.com

  4. #4
    SitePoint Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No problem - that's what forums like these are for!

    Ok - so the fields are empty. Now you need to work your way back up the logic, putting in response.write statements working back until you find where they are populated.

    Alternatively, start at the top and work down.

    If you get stuck, just ask...if we didn't want to help we wouldn't be here...
    piglet

    Moderator at The City


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
  •