Doh !! I am Total Noob, cant get any of them to work ..
PHP Code:
include 'database.php';
$root='Food';
function display_tree($root) { *
--->> $result=mysql_query("SELECT lft,rgt FROM tree WHERE title=$root"); <<---
$row=mysql_fetch_array($result);
$right = array();
$result = mysql_query("SELECT title, lft, rgt FROM tree WHERE lft BETWEEN $row[lft] AND $row[rgt] ORDER BY lft ASC");
* *while ($row = mysql_fetch_array($result)) {
* * * *if (count($right)>0) {
* * * * * *while ($right[count($right)-1]<$row['rgt']) {
* * * * * * * *array_pop($right);
* * * * * *}
* * * *}
* * * *echo str_repeat(' *',count($right)).$row['title']."\n";
* * * *$right[] = $row['rgt']; *
* *} *
}
PHP Code:
include 'database.php';
$parent='Food';
$level='0';
function display_children($parent, $level) {
$result = mysql_query("SELECT * FROM tree WHERE rgt BETWEEN 1 AND 18 ORDER BY lft ASC");
while ($row = mysql_fetch_array($result)) {
echo str_repeat(' ',$level).$row['title']."\n";
display_children($row['title'], $level+1);
}}
Restructured table as same on article 2 with same inputs ...
when i tried first code for error on 4th lines, marked there..
when tried second code as you said, no output on page ...
~Edit~ It Seems Like function variable() giving no out put...
any way to check that .. ??