title: How to display random image and text from MySQL Database with PHP
body: <p>I'm trying to make this html page (display.html) display a random image submission and random text submission from my MySQL table labeled "submissions".</p>
  
  <p>This is the current code for display.html:</p>
  
  <pre><code>&lt;!doctype html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;title&gt;MIXED MESSAGES&lt;/title&gt;
  &lt;/head&gt;
   &lt;?php 
  
   //This is the directory where images will be saved 
   $target = "images/"; 
   $target = $target . basename( $_FILES['photo']['name']); 
  
   //This gets all the other information from the form 
   $name=$_POST['name'];  
   $pic=($_FILES['photo']['name']); 
  
   // Connects to your Database 
   mysql_connect("host", "username", "password") or die(mysql_error()) ; 
   mysql_select_db("voiid") or die(mysql_error()) ;
   ?&gt; 
  &lt;body&gt;
  &lt;?php
  
    $qry = mysql_query("SELECT * FROM submissions ORDER BY RAND() LIMIT 1");
  
    while($rand = mysql_fetch_assoc($qry)){
      echo $rand['name'];
      echo $rand['pic'];
    }
  
  ?&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>At the moment the page displays the text correctly, but instead of displaying a random image it will display a random images file name I.E hello5650_707133731307_3064319_n.jpg. I would also like a break between the text and the image. </p>
  
  <p>Both the text and photo fields are VARCHAR(200). Not sure if I should be using a different data type.</p>
  
  <p>Any help is very appreciated!</p>