#1
  1. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2017
    Posts
    2
    Rep Power
    0

    Data insert within a loop


    Hi I have problem with posting some variables to my mySQL database.

    the loop and the data script works perfect on their own but not within the other.

    Can't se the errorpage due my "webhotel"s preferances.

    PHP Code:
    For 1 To Request.Form("hiddencounterA")

    Call dbOpen(Connect'Öppnar databasen
        
        Dim koppling(4)
        koppling(0) = 1        '
    Arbets Id        
        koppling
    (1) = "test"     'Beskrivning
        koppling(2) = 1         '
    Bredd
        koppling
    (3) = 1         'Langd
        koppling(4) = 1        '
    Mangd

        SQL 
    "INSERT INTO Material(ArbetsId,Beskrivning,Bredd,Langd,Mangd) Values(" Koppling(0) & ",'" Koppling(1) & "'," Koppling(2) & "," Koppling(3) & "," Koppling(4) & ")"
        
    Connect.Execute(SQL)

    Call dbClose(Connect'Stänger databasen


    Next 

    Is it so that call a function does not work within a loop?
    or is it wrong of me thinking this is the way to post several data inputs?

    this is a test to post the amount of loops depending on the value in Request.Form("hiddencounterA"), later it is suposed to request different <input>s depending on the "i" value


    Excuse my english
    Regards from Sweden.

    (fun too still see an actuall active asp forum)
  2. #2
  3. No Profile Picture
    Registered User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2017
    Posts
    2
    Rep Power
    0
    Hi! seems I solve the big problem.

    I removed the dim's

    Dim koppling(4)
    koppling(0) = 1 'Arbets Id
    koppling(1) = "test" 'Beskrivning
    koppling(2) = 1 'Bredd
    koppling(3) = 1 'Langd
    koppling(4) = 1 'Mangd

    why cant I use this solution in a loop?

    Regards

Similar Threads

  1. Insert Records in recordset while loop
    By psuphish05 in forum ASP Development
    Replies: 2
    Last Post: October 8th, 2008, 12:47 AM
  2. Insert records in vb.net using loop
    By yasinirshad in forum .NET Development
    Replies: 2
    Last Post: February 18th, 2008, 09:40 AM
  3. Loop(?) and insert in database
    By Khrysller in forum ASP Development
    Replies: 12
    Last Post: October 17th, 2007, 09:22 AM
  4. Loop to insert record
    By deadfish in forum ASP Development
    Replies: 7
    Last Post: August 5th, 2007, 09:42 PM
  5. ASP Insert and JS form loop
    By ecoviva in forum ASP Development
    Replies: 5
    Last Post: February 19th, 2007, 06:26 AM

IMN logo majestic logo threadwatch logo seochat tools logo