display issues!

Discussion in 'PHP' started by co.ador, Sep 8, 2009.

  1. #1
    Guys I am facing a display problem which I know it will be resolved with a If else statement or some condition of that kind.
    I want that if user x click one of the submenus of the first query at or first display then user x will be able to see only first display layout below the while loop and if user x click in the subjects second display then user x will be able to see only the layout in the second display and not both how it is displaying now. as I said before right now the way it is working is that if user x click on one of the submenu in the first display then the layout of the first display appear and the layout of the second display as well and I only want it to show the one the user required first layout or second layout depending where the user clicked in other word "one at the time".Right now when user x click on the subjects 'second display layout' or Subjects menu then the layout of the second display appear this time not both together I guess becuase after the second query there is not more coding.

    Can you help me to display one at the time e.g if user x clicked on the subject menu then only the layout of subject menu will appear or if user x clicked on the submenu menu then only the layout of the submenu menu will appear.

    help please.
    
    <?php
    
    $submenu = false;
    $cat = isset($_GET['subject']) && is_numeric($_GET['subject'])?$_GET['subject']:null;
    $prod = isset($_GET['menu']) && is_numeric($_GET['menu'])?$_GET['menu']:null;
    $menu_type = isset($_GET['menu_type']) && is_string($_GET['menu_type'])?$_GET['menu_type']:null
    ?>
    
    //First Display
    <?php 
    $query = "SELECT id, submenus, image,
    FROM submenu
    WHERE
    id= " . (int) $_GET['menu']; 
    echo $query;
    $result = mysql_query($query, $connection); 
     while ($content = mysql_fetch_array($result)) {
    echo '<table border="0" cellspacing="0" cellpadding="0">
    <td>Something</td></table>';
    }
    ?>
    
    // second display
    <?php 
    $query2 = "SELECT id, Subject, image,
    FROM subjects
    WHERE
    id= " . (int) $_GET['subject']; 
    echo $query2;
    $result2 = mysql_query($query2, $connection); 
      {
    echo '<table border="0" cellspacing="0" cellpadding="0" >
    <td></td>
    </table>';
    }
    ?>
    PHP:
     
    Last edited: Sep 8, 2009
    co.ador, Sep 8, 2009 IP