title: Display random image from database using PHP
body: <p>i want to display image with randomly selected or the one that i choose from database. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>thumbnail {
  float: left;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>$query1=mysqli_query($db_con,"select * from image_tb");
     while($row=mysqli_fetch_array($query1)){
     $img = "&lt;th&gt;&lt;img src='".$row['image']."' width='260px';height='180px;' &gt;&lt;/th&gt;";
     $image_number = $row['id'];
     
     
  
  &lt;div class="block-content collapse in"&gt;
       &lt;div class="row-fluid padd-bottom"&gt;
       &lt;div class="span3"&gt;
  //i want to display here the first image on my database but i don't know how to code it properly. 
        &lt;a href="#" class="thumbnail"&gt;
        if (1 == $image_number){
            &lt;?php echo "$img"; ?&gt;
        }
         &lt;/a&gt;
         &lt;/div&gt;
         &lt;div class="span3"&gt;
  //the 2nd image from database
        &lt;a href="#" class="thumbnail"&gt;
        if (2 == $image_number){
            &lt;?php echo "$img"; ?&gt;
        }
        &lt;/div&gt;   
       &lt;/div&gt;
  &lt;?php
    }
  ?&gt;
       &lt;/div&gt;</code></pre>
  </div>
  </div>
  
  I don't really know how to code it properly. </p>