title: PHP Fetching Data From Specific MySQL Row
body: <p>Recently I've set it up so I can update my sites news via my administration panel and now I've been seeking across the web for a solution to print specific lines.</p>
  
  <pre><code>$query = "SELECT * FROM BananzaNews";
  $result = mysql_query("SELECT * FROM BananzaNews", $con);
  $num_rows = mysql_num_rows($result);
  </code></pre>
  
  <p>The above tells me how many rows I have and for my five most recent which will be shown on my home page, I want to fetch the data for $num_rows, $num_rows -1, $num_rows -2, $num_rows -3 and $num_rows -4.</p>
  
  <p>The data to fetch;</p>
  
  <ul>
  <li>title</li>
  <li>newsDate</li>
  <li>imagePath</li>
  <li>content</li>
  <li>websitePath</li>
  </ul>
  
  <p>My current dummy filled code is the following dubplicated five times;</p>
  
  <pre><code>&lt;div class="Feed"&gt;
      &lt;div class="Img"&gt;&lt;img alt="" src="http://www.davidreneke.com/wp-content/uploads/2013/12/News-Briefs.png"&gt;&lt;/div&gt;
      &lt;div class="Title"&gt;My Testing Title&lt;/div&gt;
      &lt;div class="Date"&gt;
          &lt;div class="Day"&gt;22&lt;/div&gt;
          &lt;div class="Month"&gt;Jan&lt;/div&gt;
          &lt;div class="Year"&gt;2015&lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="Brief"&gt;Vivamus consectetur et sapien vel rhoncus. Maecenas gravida posuere hendrerit. Duis lobortis justo ac justo malesuada commodo. Proin iaculis, erat ac aliquet eleifend, neque felis tristique turpis, at dictum tellus lectus et lorem. Nunc turpis enim, auctor sed purus nec.&lt;/div&gt;
      &lt;div class="More"&gt;&lt;/div&gt;
      &lt;div class="Divider"&gt;&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>My PHP</strong></p>
  
  <pre><code>&lt;?php
      $query = 'SELECT title,newsDate,imagePath,content,websitePath FROM BananzaNews ORDER BY id Desc LIMIT 5';
      $resultSe = mysql_query($query, $con);
  
      if (mysql_num_rows($result) &gt; 0) {
          while($row = $resultSet-&gt;fetchRow ( DB_FETCHMODE_OBJECT )){
              echo "&lt;div class=\"Feed\"&gt;
              &lt;div class=\"Img\"&gt;&lt;img alt=\"\" src=\"" $row-&gt;imagePath "\"&gt;&lt;/div&gt;
              &lt;div class=\"Title\"&gt;" $row-&gt;title "&lt;/div&gt;
              &lt;div class=\"Date\"&gt;
                  &lt;div class=\"Day\"&gt;" $row-&gt;newsDate "&lt;/div&gt;
                  &lt;div class=\"Month\"&gt;" $row-&gt;newsDate "&lt;/div&gt;
                  &lt;div class=\"Year\"&gt;" $row-&gt;newsDate "&lt;/div&gt;
              &lt;/div&gt;
              &lt;div class=\"Brief\"&gt;" $row-&gt;content "&lt;/div&gt;
              &lt;div class=\"More\"&gt;" $row-&gt;websitePath "&lt;/div&gt;
              &lt;div class=\"Divider\"&gt;&lt;/div&gt;
          &lt;/div&gt;";
          }
      }
  ?&gt; 
  </code></pre>
  
  <p>Database View
  <img src="https://i.stack.imgur.com/uHkFJ.png" alt="enter image description here"></p>