- Forums
- PHP
- Breadcrum Modified Pre-order Tree Transversal Mptt Sql Query
this is a perfect example tutorial on how to use a Breadcrum Modified Pre-order Tree Transversal MPTT SQL Query [1132], Last Updated: Sat May 18, 2024
wallpaperama
Sat Mar 15, 2008
1 Comments
1608 Visits
$sql = "SELECT C.* from myp1_category AS B, myp1_category AS C WHERE (B.category_left BETWEEN C.category_left AND C.category_right) AND (B.category_id = '12') ORDER BY C.category_left";
i created this query because i wanted to know how i can get the breadcrum out of a Modified Pre-order Tree Transversal menu as shown here:
mptt-modified-preorder-tree-traversal-php-tree-menu-scrip
so in keeping with this example. i want to show all the links for the bread yellow so it would look like this:
Food
Fruit
Yellow
as you can see, Yellow has a value of 5 in id colum so i can use this query to get all its perents:
$sql = "SELECT C.* from myp1_category AS B, myp1_category AS C WHERE (B.category_left BETWEEN C.category_left AND C.category_right) AND (B.id = '5') ORDER BY C.category_left";
https://www.wallpaperama.com/forums/breadcrum-modified-pre-order-tree-transversal-mptt-sql-query-t5865.html