Ask a Question related to Dreamweaver AppDev, Design and Development.
-
jefe18 #1
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
-
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... -
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... -
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... -
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... -
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.... -
boy mackman #2
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
-
jefe18 #3
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
-
jerryartman #4
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



Reply With Quote

