title: Display image from database in a php table
body: <p>I have got a simple form which someone fills out and then another form which runs a query to retrieve the data. </p>
  
  <p>Been toying around with the idea of including a images upload in the form and then getting the table to display the form data including this image. </p>
  
  <p>this is some of the code i have</p>
  
  <pre><code> if ($_SERVER['REQUEST_METHOD'] == 'POST'){
      $uname = $_POST['username'];
      $password = $_POST['password'];
  
      $uname = htmlspecialchars($uname);
      $password = htmlspecialchars($password);
  
      //==========================================
      //  CONNECT TO THE LOCAL DATABASE
      //==========================================
      $user_name = "xxxxxx";
      $pass_word = "xxxxxx";
      $database = "xxxxx";
      $server = "xxxxxx";
  
      $db_handle = mysql_connect($server, $user_name, $pass_word);
      $db_found = mysql_select_db($database, $db_handle);
  
      if ($db_found) {
  
  
  
          $SQL = "SELECT * FROM students WHERE L1 = '$uname' AND L2 = '" .md5 ($_POST['password'])."'";
          $result = mysql_query($SQL);
          $num_rows = mysql_num_rows($result);
  
      //====================================================
      //  CHECK TO SEE IF THE $result VARIABLE IS TRUE
      //====================================================
  
          if ($result) {
              if ($num_rows &gt; 0) {
                  $color="1";
  
  
  $result = mysql_query("SELECT * FROM entry, students   WHERE entry.studentName = students.studentName AND students.L1='$uname' ") 
  or die(mysql_error());  
  
  echo "&lt;p&gt;You records as of ";
  echo date('l jS \of F Y h:i:s A');
  echo "&lt;table border='1' cellpadding='2' cellspacing='0'&gt;";
  echo "&lt;tr&gt; &lt;th&gt;Date&lt;/th&gt;&lt;th&gt;Student Name&lt;/th&gt; &lt;th&gt;Tutor name&lt;/th&gt; &lt;th&gt;Procedure name&lt;/th&gt; &lt;th&gt;Grade&lt;/th&gt;&lt;th&gt;Student Reflection&lt;/th&gt;&lt;th&gt;Tutor Comments&lt;/th&gt;&lt;th&gt;Professionalism&lt;/th&gt; &lt;th&gt;Communication&lt;/th&gt; &lt;th&gt;Alert&lt;/th&gt; &lt;th&gt;Dispute&lt;/th&gt;&lt;th&gt;Username&lt;/th&gt; &lt;th&gt;Image&lt;/th&gt;&lt;/tr&gt;";
  // keeps getting the next row until there are no more to get
  while($row = mysql_fetch_array( $result )) {
  
  if($color==1){
  echo "&lt;tr bgcolor= &gt;
  &lt;td&gt;".$row['date']."&lt;/td&gt;&lt;td&gt;".$row['studentName']."&lt;/td&gt;&lt;td&gt;".$row['tutorName']."&lt;/td&gt;&lt;td&gt;".$row['procedureName']."&lt;/td&gt;&lt;td&gt;".$row['grade']."&lt;/td&gt;&lt;td&gt;".$row['studentReflection']."&lt;/td&gt;&lt;td&gt;".$row['tutorComments']."&lt;/td&gt;&lt;td&gt;".$row['professionalism']."&lt;/td&gt;&lt;td&gt;".$row['communication']."&lt;/td&gt;&lt;td&gt;".$row['alert']."&lt;/td&gt;&lt;td&gt;".$row['dispute']."&lt;td&gt;".$row['L1']."&lt;/td&gt;&lt;/td&gt;
  &lt;td&gt;&lt;img src='images/".$row['studentImage']."'&gt;&lt;/td&gt;;
  
  
  &lt;/tr&gt;";
  
  // Set $color==2, for switching to other color
  $color="2";
  }
  
  // When $color not equal 1, use this table row color
  else {
  echo "&lt;tr bgcolor='#4eb557'&gt;
  &lt;td&gt;".$row['date']."&lt;/td&gt;&lt;td&gt;".$row['studentName']."&lt;/td&gt;&lt;td&gt;".$row['tutorName']."&lt;/td&gt;&lt;td&gt;".$row['procedureName']."&lt;/td&gt;&lt;td&gt;".$row['grade']."&lt;/td&gt;&lt;td&gt;".$row['studentReflection']."&lt;/td&gt;&lt;td&gt;".$row['tutorComments']."&lt;/td&gt;&lt;td&gt;".$row['professionalism']."&lt;/td&gt;&lt;td&gt;".$row['communication']."&lt;/td&gt;&lt;td&gt;".$row['alert']."&lt;/td&gt;&lt;td&gt;".$row['dispute']."&lt;td&gt;".$row['L1']."&lt;/td&gt;&lt;/td&gt;
  &lt;td&gt;&lt;img src='images/".$row['studentImage']."'&gt;&lt;/td&gt;;
  &lt;/tr&gt;";
  // Set $color back to 1
  $color="1";
  }
  
  }
  echo '&lt;/table&gt;';
  </code></pre>
  
  <p>When the results come back I have fetched all the data apart from the image which is just displayed as a load of characters.</p>
  
  <p>Where am I going wrong?</p>