Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9090075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T22:17:35+00:00 2026-06-16T22:17:35+00:00

I am beginner to PHP and mySQL. I am creating a navigation trough my

  • 0

I am beginner to PHP and mySQL. I am creating a navigation trough my database. I have two tables set up one is the main nav items and one is the sub nav items. They are connected by the subject_id. I am using a loop to display them. The first table displays and the second table leaves space for where the information should be but it does not show up. I think it must be something in the SQL settings but I have no idea. Here is my code(i know the database is connected):

    <?php require_once("includes/connection.php") ?>
    <?php require_once("includes/functions.php") ?>
    <?php include("includes/headder.php") ?>
    <table id="structure">
    <tr>
    <td id="navigation">
        <ul class="subjects">
    <?php
        $subject_set = mysql_query("SELECT * FROM subjects", $connection);
        if(!$subject_set){
            die("database query failed: " . mysql_error());
        }

        while ($subject = mysql_fetch_array($subject_set)) {
            echo "<li>" . $subject["menu_name"] . "</li>";



        $page_set = mysql_query("SELECT * FROM pages WHERE subject_id =    {$subject["id"]}", $connection);
        if(!$page_set){
            die("database query failed: " . mysql_error());
        }


        echo "<ul class=\"pages\">";
        while ($page = mysql_fetch_array($page_set)) {
            echo "<li>" . $page["menu_name"] . "</li>";
        }
        echo "</ul>";
        }
    ?>
    </ul>

    </td>
    <td id="page">
        <h2>Content Area</h2>

    </td>
    </tr>
    </table>
    <?php include("includes/footer.php") ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T22:17:36+00:00Added an answer on June 16, 2026 at 10:17 pm

    Since you mentioned that white space is showing where the data should be, it appears that rows are indeed found. Consequently, your select statement should be ok. This most likely means that the index “menu_name” can’t be found on the $page record.

    Check to make sure that “menu_name” is indeed a column of the pages table.

    To test what valid columns the $page record has you can use the following inside the while $page loop:

    var_dump($page);
    

    If the subject id is an integer you do not need single quotes in the where clause. However, if the subject_id contains any non-integer characters, your select statement would need to be:

    $page_set = mysql_query("SELECT * FROM pages WHERE subject_id =  '{$subject["id"]}'", $connection);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hi everyone im beginner in php & mysql here im joining 3 tables but
I'm beginner in php and mysql and I need your help in one situation.
I am a beginner in web designing (php, mysql). I am creating a classified
I have trouble with creating an approval form as am still php beginner, the
I am a beginner to php and mySQL and I am currently using dreamweaver
I am a PHP beginner. I have developed a social networking website similar to
I am a beginner to PHP and MySQL so please bear with me... I
Here's my background: Decent experience with PHP/MySql. Beginner's experience with OOP Why I want
I'm a beginner with php and have created a code displaying a table with
i am beginner in php and mysql, php where I make an HTML table

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.