or is it not possible
Code: Select all
LOCK TABLE nested_category WRITE;
SELECT @myRight := rgt FROM nested_category
WHERE name = 'TELEVISIONS';
UPDATE nested_category SET rgt = rgt + 2 WHERE rgt > @myRight;
UPDATE nested_category SET lft = lft + 2 WHERE lft > @myRight;
INSERT INTO nested_category(name, lft, rgt) VALUES('GAME CONSOLES', @myRight + 1, @myRight + 2);
UNLOCK TABLES;
So if the part where I create @myRight is in a seperate mysql_query call from the 2 UPDATE parts,
will @myRight even be carried over in the 2 subsequent calls? Doesn't seem so.