Updating several sql fields with php at the same time

HI all

Title gives an idea of what I want to happen.

I have a database which is basically a league table with the highest point scorer at the top and the lowest at the bottom. I have been receiving each rounds scores via a spreadsheet which I then had to mess about with so that I could eventually import it to the database. It takes about an hour and a half to do for each event

There are several fields in the database table. e.g. id, first name, last name, event, round 1, round 2, round 3, up to round 8.

I know how to call up and update one record at a time but was wondering if there was a way to call up all the records for a given event, input that weeks rounds scores for each and hit the update button so they are all updated in one go.

If someone could tell me if it or isn’t possible would be a great start and if they could point me in the direction of the right term to search on or show me a tutorial to achieve this I would be very grateful.

Many thanks for reading

If you store each set of results on a line in a CSV file like,

id, first name, last name, event, round 1, round 2, round 3, …

You would read in the file line by line into an array.

You then cycle through the array, and use explode to divide up the line into the individual fields and place them into variables.

You then add the row to your table and go again until the array is exhausted.

Have a look at http://www.homeandlearn.co.uk/php/php10p7.html

I already receive the results in csv file, however they have a dozen more field in the csv file that I dont need. If i delete the fields in messes up the formulas in there and make the file unusable. I want to get away from the csv file altogether and input the the data into an online form and update the scores that way.

There must be a way of updating several rows with a simple click of the button rather than doing each one individually

yes, you can do that

just load the new stuff into a table and use a joined update

i’d show you, but i don’t know what your tables look like

:slight_smile: