Sports Stats: Insert Multiple Records with PHP

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Sports Stats: Insert Multiple Records with PHP

    Hello,

    After searching the web and this forum, it seems like this is a fairly common
    question, but I have yet to find a clear solution to my specific problem.

    I have a football website where I need to insert player stats after the game.
    I have about 25 players per game... and about 8 different stats kept for each
    player.

    How can I insert stats for every player from one page?? For each row in my
    table I would like to have the player name and then text boxes for each of the
    stats I'll be keeping. Taking care of every player in the one table on one page
    seems like the best way to do this... but I am not sure how to code it.

    Has anyone dealt with this before? I've seen posts of multiple record inserts
    on this forum, but they all deal with check boxes... and I'm not using check
    boxes.

    Any help would be GREATLY appreciated.

    jefe18 Guest

  2. Similar Questions and Discussions

    1. Insert Multiple form records into DB
      I have a form that populates with data from several queries and calcs, it creates about 70 rows of form data. I need for the form fields to be...
    2. update multiple records in multiple tables from one form
      hello I have been trying to run multiple update queries based on the data entered by user. Brief background: I am fetching data from various...
    3. insert multiple records with ASP.NET
      Ok, I have seen the question asked, yet have not seen any answers. I know how to insert multiple records with .asp, but how would I do it with...
    4. How to insert multiple records to the same table with a multi-fields form
      Hi all, is it possibile to insert multiple records in the same table? I imagine to build a multi-rows form, with the same number of fields per...
    5. insert records
      See if a file with an extension .ldb (probably your db_file_name.ldb) is present. If yes, try to delete it. If it says: file in use, try to quit DW....
  3. #2

    Default Re: Sports Stats: Insert Multiple Records with PHP

    You may be able to find code to do this for you - i am sure someone will have a
    link - but this can also be coded by you. 1) Have 1 form that contains all of
    the information you need for all of the players you need. Each line (players
    stats) is numbered 1 to 25 i.e. P1Name, P1Rating, P1Goal, P1Assists P2Name,
    P2Rating, P2Goal, P2Assists etc... P25Name, P25Rating, P25Goal, P25Assists The
    form posts its details to a page that will insert the data for you. 2) Insert
    Page - this page will collect the field values and insert them into the
    database. The easiest way to do this would be to perfom a loop until all of
    the players stats have been inserted. The page will then take you to a
    'Updated Page'. Now on how you code this would verymuch depend on what you can
    use, asp, php or something else. I hope this at least shows how this will work
    and perhaps lead you onto developing the code yourself. ONce you get this
    nailed there is nothing left to fear!!!

    boy mackman Guest

  4. #3

    Default Re: Sports Stats: Insert Multiple Records with PHP

    Thanks for the response Mackman.

    Not quite sure about the loop you mention... I'm a bit green to PHP or any
    code for that matter. Any advice on that would be appreciated.

    And if anyone has sample code or tutorials on a multiple record insert that
    would also be greatly appreciated.



    jefe18 Guest

  5. #4

    Default Re: Sports Stats: Insert Multiple Records with PHP

    Think of it this way, MySQL and most SQL code only inserts one record per
    statement. Therefore, you have to loop through the fields with info as record
    field groups. There are a number of ways to do this, but the important issue is
    defining the field names in the form. Each field set has to be unique.
    R1field1, R2field2 for example, or field(1), field(2). Then in your logic, you
    need to test to make sure that there's data in the fieldset you are working
    with. If so you make up and insert command and do it. Thats the loop you will
    need.

    jerryartman Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139