this is the soucrce code that ive tried to implement .......
to see an actual to what i try to say ...please visit: http://brilliants/multimania.com/mytree1.php
<code>
<table border=1 width=100%>
<tr>
<?php
#----- trying to make a tree-------- i wish!---
include("inc/globalvar.inc");
include("inc/dbshare.inc");
#-----connection -----------
$connection=connectMYSQL();
mysqldb();
#------------------
if ($CatLvlID=="")
{
$CatLvlID=0;
}
else
{
$CatLvlID = $CatLvlID;
}
$query="SELECT * FROM categories WHERE CatLvlID=$CatLvlID"; //Category Level ID
$or= " OR CatPrntID ='$CatPrntID'"; //Category Parent ID
$query .= $or;
$result = mysql_query($query);
echo "<br> excuted query $query<br>";
if(!$result)
{
echo mysql_error();
echo "<br> $query";
}
else
{
while ($record = mysql_fetch_array($result))
{
$CatID=$record[0]; //category id
$CatPrntID=$record[1]; //category parent id
$CatLvlID=$record[2]; //category level id
$CatNm=$record[3]; // category name
echo "<td>";
print("<a href=$PHP_SELF?CatLvlID=$CatLvlID&CatPrntID=$CatID>$CatID</a>");
print("catID: $CatID");
echo "</td>";
echo "<td>";
print("ParentID: $CatPrntID");
echo "</td>";
echo "<td>";
print("LevelID: $CatLvlID");
echo "</td>";
echo "<td>";
print("Name: $CatNm");
echo "</td>";
echo "</tr>";
}
}
echo "</table>";
mysql_close($connection);
?>
</code>