I have a table with id, pid(parent), title and page_name(url) fields.

The vars provided to the script are the current page's title, id and
pid(parent)

When I am on the parent page I get this(Which is what I want):
[ Chronological History ][ Website Chronological History ]

When I am in the Child I get this:

[ Website Chronological History ][ Website Chronological History ]

What am I doing wrong???

I have stared at this two many times now and am probably missing the obvious

function menu($id, $pid, $title) {
    $query = "select * from meta_data WHERE pid = '$id' OR pid = '$pid' &&
pid != 0";
    $result = mysql_query($query);
    $num_results = mysql_num_rows($result);
  if($num_results != 0){
  ?>
<table width="100%">
<tr><td align="center">
  <?
    echo '[ '.$title.' ]';
    for ($i=0; $i < $num_results; $i++)
      {
        $row = mysql_fetch_array($result);
        if($id == $row['id']){
            echo '[ '.$row['title'].' ]';
        } elseif($row['pid'] == $id || $row['id'] == $pid && $pid != 0) {
            echo '[ <a
href="'.$row['page_name'].'">'.$row['title'].'</a> ]';
        }
      }
    ?>
</td></tr>
</table>
  <?
  }





-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to