Note that there are some explanatory texts on larger screens.

plurals
  1. PODisplaying menu names from CMS
    primarykey
    data
    text
    <p>I have been trying to display a menu name from my CMS database that I created myself, I got it displayed perfectly but there is a really weird error, I spent many hours to discover the solution but I couldn't.</p> <p>The problem is that I want to display the menu name as page H1 in line 50 exactly so whenever you click on the menu name its also displaying as H1 title.</p> <p>The menu name is displaying correctly, but the sub menu(pages) displaying N instead of the page name, I don't know where is that N is coming from.</p> <p>NOTE: There is no problem with the database connection or retrieving data.</p> <p>This is my content page code:</p> <pre><code>&lt;?php include("includes/header.php"); ?&gt; &lt;?php require_once 'includes/db_connection.php'; ?&gt; &lt;?php require_once 'includes/b_functions.php'; ?&gt; &lt;?php require_once 'includes/cms_constants.php'; ?&gt; &lt;?php db_connect();?&gt; &lt;?php if (isset ( $_GET ['subj'] )) { $sel_subject = get_subject_by_id ( $_GET ['subj'] ); $sel_page = "NULL"; } elseif (isset ( $_GET ['pages'] )) { $sel_subject = false; $sel_page = get_page_by_id ( $_GET ['pages'] ); } else { $sel_subject = "NULL"; $sel_page = "NULL"; } ?&gt; &lt;table id="structure"&gt; &lt;tr&gt; &lt;td id="navigation"&gt; &lt;ul class="subjects"&gt; &lt;?php $subject_set = get_all_subjects(); while ($subject = mysql_fetch_array($subject_set)) { echo "&lt;li"; if ($subject["id"] == $sel_subject["id"]) { echo " class=\"selected\""; } echo "&gt;&lt;a href=\"contents.php?subj=" . urlencode($subject["id"]) . "\"&gt;{$subject["menu_name"]}&lt;/a&gt;&lt;/li&gt;"; $page_set = get_pages_for_subject($subject["id"]); echo "&lt;ul class=\"pages\"&gt;"; while ($page = mysql_fetch_array($page_set)) { echo "&lt;li"; if ($page["id"] == $sel_page["id"]) { echo " class=\"selected\""; } echo "&gt;&lt;a href=\"contents.php?pages=" . urlencode($page["id"]) . "\"&gt;{$page["menu_name"]}&lt;/a&gt;&lt;/li&gt;"; } echo "&lt;/ul&gt;"; } ?&gt; &lt;/ul&gt; &lt;/td&gt; &lt;td id="page"&gt; &lt;?php if (!is_null($sel_subject)) { // subject selected ?&gt; &lt;h2&gt;&lt;?php echo $sel_subject['menu_name']; ?&gt;&lt;/h2&gt; &lt;?php } elseif (!is_null($sel_page)) { // page selected ?&gt; &lt;h2&gt;&lt;?php echo $sel_page['menu_name']; ?&gt;&lt;/h2&gt; &lt;div class="page-content"&gt; &lt;?php echo $sel_page['content']; ?&gt; &lt;/div&gt; &lt;?php } else { // nothing selected ?&gt; &lt;h2&gt;Select a subject or page to edit&lt;/h2&gt; &lt;?php } ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;?php require_once 'includes/footer.php';?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload