Jump to content

Nav Tree


ShibSta

Recommended Posts

Sup, I am trying to figure out how to make a nav menu that pulls Categories, SubCategories, and Category ID's from my database. (MySQL) Then make a navigation tree with the data.

I'll tell ya before I go any further, this is part of a script I bought. I know it's very sloppy and some of it is pretty retarded... However, I'd have to recode the entire thing to fix most of it.
Anyway, currently I have this script.

[code]<?php
  $self = $_SERVER['PHP_SELF'];
  $get22 = "SELECT cId, cName, gamesnumber FROM categories WHERE cVisible = 1 AND mcid = '1' ORDER BY $cat_sort ASC";
  $result22 = @mysql_query($get22);
  while (list($id, $name, $gamesnumber) = @mysql_fetch_row($result22)) {
      echo "<a href=./test.php?lid=$id class=catename>$name<br>";
  }
  $gameid5 = $_GET['lid'];
  if (!isset($gameid5)) {
      $gameid5 = "10";
  }
  $get22 = "SELECT cId, cName, gamesnumber FROM categories WHERE cVisible = 1 AND mcid = '0' AND  pcid ='$gameid5' ORDER BY $cat_sort ASC";
  $result22 = @mysql_query($get22);
  while (list($id, $name, $gamesnumber) = @mysql_fetch_row($result22)) {
      echo "<a href=./test.php?action=category&id=$id&page=0&order2=game_name&sby=ASC class=catesub>- $name <i>($gamesnumber)</i><br>";
  }
?>
[/code]
Which displays something like this:
[quote]Cartoons
Games
Movies
- Cartoons (0)[/quote]
[quote]Cartoons
Games
Movies
- Action / Adventure (0)
- Sports (0)
- Other (0)
[/quote]
[quote]Cartoons
Games
Movies
- Commercials (0)
- Misc (0)
- Pranks (0)
- Sports (0)
[/quote]

As you see it keeps displaying them at the bottom of the page, plus it has to reload the page each time.
I am wanting a JS menu so that it won't reload the page each time, and a tree so it's easier to understand.
However, I know nothing about combining PHP/JS.
Could someone assist me in a situation like this please?
Thanks,
--ShibSta
(PS: Sorry if this is the wrong forum, it sorta fit under 3 different ones.)
Link to comment
Share on other sites

If you are wanting to update content without refreshing the page, you are going to need to have a look at XMLHTTPRequest. [a href=\"http://www.ajaxfreaks.com/tutorials.php\" target=\"_blank\"]Ajax Freaks[/a] has some nice tutorials etc. Not much good at JS i'm afraid, so i can't help you there. Good Luck.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.