Home » Database » DB_NestedSet » Bug #1683
Error in deleting and insert a node
Details
| Submitted | 2004-06-20 08:49 UTC |
|---|---|
| From | michael180674 at tiscali dot de |
| Assigned | datenpunk |
| Status | Closed |
| Package | DB_NestedSet |
| PHP Version | 4.3.6 |
| OS | Win XP |
| Roadmaps | (Not assigned) |
Comments
[2004-06-20 08:49 UTC] michael180674 at tiscali dot de
Description:
------------
- In case of insert a new sub node to a existing sub node I receive the following debug:
UPDATE menue SET norder=norder+1 WHERE rootid=1 AND norder>1 AND level=2 AND lft BETWEEN 1 AND 4 [nativecode=1064 ** You have an error in your SQL syntax near 'norder=norder+1 WHERE rootid=1 AND norder>1 AND level=2 AND ' at line 1] (-2) in file pear\NestedSet.php at line 1331
I use the following statement for creating sub nodes:
$nestedSet -> createSubNode($rootid, $values);
- In case of deleting a node I receive a error like this:
Fatal error: UPDATE menue SET norder=norder-1 WHERE rootid=1 AND level=2 AND norder>1 AND lft BETWEEN 1 AND 4 [nativecode=1064 ** You have an error in your SQL syntax near 'norder=norder-1 WHERE rootid=1 AND level=2 AND norder>1 AND lft ' at line 1] (-2) in file pear\NestedSet.php at line 1411 in pear\PEAR.php on line 762
The node is deleted but why I receive this error?
What's going wrong in these cases?
[2004-06-20 10:12 UTC] dk at webcluster dot at
Quick guess:
The norder field does not exist.
Could you please try to compare the $params array with your database schema.
$params = array(
'id' => 'id',
'parent_id' => 'rootid',
'left_id' => 'l',
'right_id' => 'r',
'order_num' => 'norder',
'level' => 'level',
'name' => 'name',
);
$nestedSet =& DB_NestedSet::factory('DB', $dsn, $params);
In this case you should have a column named order_num.
So the left part is the column and the right part the alias inside the class.
Please let us know if you are able to fix this problem.
[2004-06-20 18:30 UTC] michael180674 at tiscali dot de
Thanks, now it works fine!
But it's not clear because the norder coulumn was defined in the params as order.
I renamed the column to "sort" and now it works fine.