title: Creating HTML Nav from a database PHP
body: <p>I am currently redesigning my website to use PHP and databases (opposed to Bootstrap, CSS, and HTML) and I am currently having issues grabbing my links from my database and putting them in my nav menu. I prefer to use a database to prevent the need of re-entering all the links if I eventually decide to change them. The issue is I can't seem to get any HTML output here, and I'm not sure what I'm doing wrong. I am fairly new to PHP so there may be something trivial that I just haven't grasped the concept of but currently this code only displays the bullet point of the <code>&lt;ul&gt;</code> on the page. My database and code are below. The database is confirmed able to connect.</p>
  
  <p><a href="https://i.stack.imgur.com/Zderg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Zderg.png" alt="enter image description here"></a></p>
  
  <p>test.php:</p>
  
  <pre><code>require_once('config.php');
  $conn = new mysqli($servername, $username, $password, $database);
  
  /* check connection */
  if (mysqli_connect_errno()) {
      printf("Connect failed: %s\n", mysqli_connect_error());
      exit();
  }
  
  $query = "SELECT link_title, link_url FROM links ORDER BY link_id";
  
  if ($result = $conn-&gt;query($query)) {
  
      echo '&lt;ul class="nav navbar-nav navbar-right"&gt;';
      foreach($result as $link) {
          echo '&lt;li&gt;';
          echo "&lt;a href='{$link-&gt;link_url}'&gt;{$link-&gt;link_title}&lt;/a&gt;\n";
          echo '&lt;/li&gt;';
      }
      echo '&lt;/ul&gt;';
  
      /* free result set */
      $result-&gt;close();
  }
  
  /* close connection */
  $conn-&gt;close();
  </code></pre>