title: Get data from database and use loop in php
body: <p>I am working on college project and i am stuck at the moment.</p>
  
  <p>I have a table and it have multiple records. Records are saved by user. I want to show all data stored by specific user on webpage (under a separate div). 
  I am able to fetch all data from database by using below code.</p>
  
  <pre><code>$prj= mysql_query("select * from project where uid=$uid");
          $record= mysql_fetch_assoc($prj);
          $project_name = "$record['project_name']";
          $short_dis= "$record['short_dis']";
          $poster= "$record['poster']";
  
  mysql_close($prj);
  </code></pre>
  
  <p>Here are some php code.</p>
  
  <pre><code>    &lt;div class="media services-wrap55 wow fadeInDown"&gt;
      &lt;img class="img-responsive" src="uploads/poster/photo-original_827156899.jpg"&gt;&lt;br&gt;
   &lt;a href="#"&gt; &lt;h4 class="media-heading"&gt;second project for testing&lt;/h4&gt;&lt;/a&gt;
   &lt;p&gt;    by user&lt;/p&gt;
   &lt;p&gt; second project for testing  second project for testing  second project for testing  second project for testing.&lt;/p&gt;
  
   &lt;a class="" href="iska-link.html"&gt;More ... &lt;/a&gt;
   &lt;p&gt;
   &lt;div id="progressBar2" class="tiny-green"&gt;&lt;div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;
   &lt;div class="counter-inner"&gt;&lt;div id=example1" data-countdown="07/02/2015 00:11:00"&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;
   &lt;div class="col-sm-11 text-right"&gt;
     &lt;div class="entry-meta"&gt;
  
   &lt;span&gt;&lt;i class="fa fa-comment"&gt;&lt;/i&gt;&lt;a href="comments"&gt;  2 Comments &lt;/a&gt;&lt;/span&gt;
   &lt;span&gt;&lt;i class="fa fa-thumbs-up"&gt;&lt;/i&gt;&lt;a href="#"&gt; 56 &lt;/a&gt;&lt;/span&gt;
   &lt;span&gt;&lt;i class="fa fa-thumbs-down"&gt;&lt;/i&gt;&lt;a href="#"&gt; 56 &lt;/a&gt;&lt;/span&gt;
   &lt;span&gt;&lt;i class="fa fa-star"&gt;&lt;/i&gt;&lt;a href="#"&gt; 56 Fav &lt;/a&gt;&lt;/span&gt;
    &lt;/div&gt;
    &lt;/div&gt;
   &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>As you can see these are static data. I want to put dynamic data from database in this.</p>
  
  <p>Is there any advise how to get the data in div by loop. </p>
  
  <p>I can show one record by using echo. I am not looking for entire code just wanted database part and some sample while using it in php.</p>