Question: PHP Form Submits But Only Updates Last Row. I am trying to update multiple data in the performance table but only the last row is

PHP Form Submits But Only Updates Last Row.

I am trying to update multiple data in the performance table but only the last row is being updated. In the performance table there are two primary keys. Player Id and Practice number. Each player can have multiple practice numbers. I am trying to update the practice performance data of each player but only the last practice performance data is being updated. Performance table is shown below.

PHP Form Submits But Only Updates Last Row. I am trying to

This is the code which is not working and is only updating the last practice data for each player Id:

update multiple data in the performance table but only the last row

This is the code for update.php:

include("connection.php");

$query = "update performance set practise_no='$_POST[practise_no]',time='$_POST[time]',points='$_POST[points]' where id = '$_POST[id]' AND practise_no ='$_POST[practise_no]'";

$query_run = mysqli_query($link,$query);

?>

In the where clause, both id and practise number is given so that we can identify the unique row in the performance table (for which id and for which practise number the data is being updated).

Please tell me what have I done wrong. On the internet, I have seen people facing similar problem are using arrays to solve this issue. Please can you show me how its done or by using any other method.

score id practise_no laptime 1 1 02:01:19.000000 98 1 2 02:02:14.000000 23 13 02:01:14.000000 74 2 1 02:01:14.000000 34 HTT

HOWCOSYS S SSSSSS 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 o HITE 32 33 34 35
1) in

36 37 38 39 40

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!