I have three tables:
Table Results:
Table Ladder:
Table Predictions
I want to add points to all ids in Table Ladder, triggered by insertions, modifications or removals in Table Results, depending on the value of homeScore,awayScore from table Predictions.
And I have rules like:
Is this possible with only SQL? If not, how do I approach this with PHP?
You can do this if you define triggers. Compare new result with old result upon insert/update/delete and your problem will be solved. Read some tutorials about triggers for the RDBMS you are using and you will be able to solve the problem.