Forum Moderators: coopster
<?
mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT DISTINCT title FROM contentdb WHERE title = cat AND enabled='1'" ) or die("SELECT Error: ".mysql_error());
while ($get_info = mysql_fetch_row($result)){
foreach ($get_info as $field)
print "<h2>$field</h2>\n";
print"<script language='Javascript'>\n";
print"var TREE_NODES = [\n";
$result2 = mysql_query( "SELECT DISTINCT title FROM contentdb WHERE cat='$field' AND subcat1 = title AND enabled='1'" ) or die("SELECT Error: ".mysql_error());
while ($get_info2 = mysql_fetch_row($result2)){
foreach ($get_info2 as $field2)
print "['$field2', './', null, ";
$result3 = mysql_query( "SELECT DISTINCT title FROM contentdb WHERE subcat2='$field2' AND enabled='1' " ) or die("SELECT Error: ".mysql_error());
while ($get_info3 = mysql_fetch_row($result3)) {
foreach ($get_info3 as $field3)
echo"\n['$field3', './', null],";
}
print"],\n";
}
echo"];";
?>
</script>
<script language='JavaScript'>
var tree<? echo $field{0};?> = new COOLjsTreePRO('menu<? echo $field{0};?>', TREE_NODES, TREE_FORMAT);
</script>
<script language='JavaScript'>
tree<? echo $field{0};?>.init();
tree<? echo $field{0};?>.expandNode(<? echo $field{0};?>);
</script>
<script language='JavaScript'>
RedrawAllTrees()
</script>
<?
}
?>
few more questions.
so now my links look like
widgets.com/articles/index.php?article=1
where 1 is the number of the article so 1 equals a number. What would i need to do make it so that when you click on one of the links, it will pull the article from the link, and user it in an sql query to pull the content from the database with the article number equal to that of the link. So the above link would pull article 1. hope this makes sense
<?
mysql_select_db($db , $link) or die("Couldn't open $db: ".mysql_error());
$result = mysql_query( "SELECT DISTINCT title FROM contentdb WHERE title = cat AND enabled='1'" ) or die("SELECT Error: ".mysql_error());
while ($get_info = mysql_fetch_object($result)){
print "<h2>$get_info->title</h2>\n";
print"<script language='Javascript'>\n";
print"var TREE_NODES = [\n";
$result2 = mysql_query( "SELECT DISTINCT title, article FROM contentdb WHERE cat='$get_info->title' AND subcat1 = title AND enabled='1'" ) or die("SELECT Error: ".mysql_error());
while ($get_info2 = mysql_fetch_object($result2)){
print "['$get_info2->title', '/articles/index.php?article=$get_info2->article', null, ";
$result3 = mysql_query( "SELECT DISTINCT title, article FROM contentdb WHERE subcat2='$get_info2->title' AND enabled='1' " ) or die("SELECT Error: ".mysql_error());
while ($get_info3 = mysql_fetch_object($result3)) {
echo"\n['$get_info3->title', '/articles/index.php?article=$get_info3->article', null],";
}
print"],\n";
}
echo"];";
?>
</script>
<script language='JavaScript'>
var tree<? echo $get_info->title{0};?> = new COOLjsTreePRO('menu<? echo $get_info->title{0};?>', TREE_NODES, TREE_FORMAT);
</script>
<script language='JavaScript'>
tree<? echo $get_info->title{0};?>.init();
tree<? echo $get_info->title{0};?>.expandNode(<? echo $get_info->title{0};?>);
</script>
<script language='JavaScript'>
RedrawAllTrees()
</script>
<?
}
?>