Welcome Guest, Not a member yet? Register   Sign In
How to update a field by adding a value to the existing value?
#1

[eluser]ajh_8[/eluser]
Hello Smile

I was just wondering if anyone could give me some advice about how to go about adding a value to an existing field value.

Basically, I have a form that confirms a football result.

Part of the form is to get players from the requested teams and add if and how many goals a certain player scored with the match.

So I need to pull their existing goalcount from the database and then allow the user to select how many goals they scored in the match and when confirmed, add their goals scored to their existing goal tally.


Thanks for any advice in advance Smile
Adam
#2

[eluser]toopay[/eluser]
i'll do that this way :

+------------------+
| players_table |
+------------------+
| id |
| name |
| team_id |
+------------------+

+------------------+
| goals_table |
+------------------+
| id |
| minutes |
| player_id |
| home_team_id |
| away_team_id |
| match_date |
+------------------+

With this db structure, i can get single result and grouped result (goals at a match or total goals) for every player in 'players_table'. Everytime player 'A' make a goal, i'll insert one row at 'goals_table' related with player 'A'.
#3

[eluser]toopay[/eluser]
Code:
+-----------------+
| players_table   |
+-----------------+
| id              |
| name            |
| team_id         |
+-----------------+

+-----------------+
| goals_table     |
+-----------------+
| id              |
| minutes         |
| player_id       |
| home_team_id    |
| away_team_id    |
| match_date      |
+-----------------+




Theme © iAndrew 2016 - Forum software by © MyBB