I have an application for learning by moving throug a hierarchy of units. When learning you can go through the units in the same level ("go left-right") or go "down" to a lower level.
Two tables:
learnings (id*,fk_user, fk_starting_unit, belongs_to)
learning_structure (fk_unit, fk_learnings, completed)
When the user goes "down" I add a new Learning that "belongs_to" the previous one. Then I get all units on the lower level and add them to the learning structure so I can move through them.
In the moment the user goes "down" I still have to make the current unit "completed" and then move on to lower level units.
SAMPLE STRUCTURE:
Learnings (1, 99, 100, NULL)
Learnings (2, 99, 102, 1) -> this added when I want to go "down"
Learning Structure (100, 1, 1)
Learning Structure (101, 1, 1)
Learning Structure (102, 1, 0) -> here I click the link to go "down", a new Learning added and items below added
Learning Structure (103, 2, 0)
Learning Structure (104, 2, 0)
PROBLEM:
$prev_id = 1
$uid = 102
$phql = "UPDATE LearningStructure SET completed=1 WHERE fk_learnings=$prev_lid AND fk_unit = $uid";
$result = $this->modelsManager->executeQuery($phql);
RESULT:
Learning Structure (102, 1, 0) - not updated
Learning Structure (103, 2, 1) - UPDATED???
Why???