Inserting multiple records!!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tamimmakki
    New Member
    • Nov 2007
    • 6

    Inserting multiple records!!!

    hi, i have to add names of 11 players of a team into database table 'tbl_players'. so i put 11 text boxes in form with a submit button. I tried it with a for loop but its not working. I am working in php.
    Last edited by tamimmakki; Nov 27 '07, 09:41 PM. Reason: forget to tell abt language using
  • Lumpy
    New Member
    • Oct 2007
    • 69

    #2
    Originally posted by tamimmakki
    hi, i have to add names of 11 players of a team into database table 'tbl_players'. so i put 11 text boxes in form with a submit button. I tried it with a for loop but its not working. I am working in php.
    You might want to try a foreach loop, which can go through all the variables in the POST array and insert them.

    Something like...
    [CODE=php]
    foreach ($_POST as $key => $value) {
    ///SQL insert code here
    }
    [/CODE]

    Try that and if you still can't get it maybe post some code and we can see if we can help troubleshoot the code with you.

    Comment

    • tamimmakki
      New Member
      • Nov 2007
      • 6

      #3
      Originally posted by Lumpy
      You might want to try a foreach loop, which can go through all the variables in the POST array and insert them.

      Something like...
      [CODE=php]
      foreach ($_POST as $key => $value) {
      ///SQL insert code here
      }
      [/CODE]

      Try that and if you still can't get it maybe post some code and we can see if we can help troubleshoot the code with you.
      with array it works, thanks

      Comment

      Working...