title: How to display mysql blob image in php form product table
body: <p>After two days of search I come here with the hope of finding a solution.
  I'm trying to display the images uploaded into my database with type BLOB but there is something wrong the image is not displaying just the 64 code for the image
  here is the code : </p>
  
  <p></p>
  
  <p>          </p>
  
  <pre><code>&lt;div id="container"&gt;
  
       &lt;img src ="banner.jpg" width="400" height="100"/&gt;
  
  
          &lt;div id="menu"&gt;
  
              &lt;h3&gt;
              &lt;li&gt;&lt;a href="refresher.php"&gt;Home  &lt;/a&gt; &lt;/li&gt;
              &lt;li&gt;&lt;a href="refresher2.html"&gt;About  &lt;/a&gt; &lt;/li&gt;
              &lt;li&gt;&lt;a href="refresher3.html"&gt;Category  &lt;/a&gt;
  
              &lt;ul&gt;    &lt;li&gt;&lt;a href="Boys.php"&gt;Boys&lt;/a&gt;&lt;/li&gt; 
                      &lt;li&gt;&lt;a href="Girls.php"&gt;Girls&lt;/a&gt;&lt;/li&gt; 
                      &lt;li&gt;&lt;a href="#"&gt;Uni&lt;/a&gt;&lt;/li&gt; 
               &lt;/ul&gt;
               &lt;/li&gt;
  
              &lt;li&gt;&lt;a href="refresher3.html"&gt;Costume Hire  &lt;/a&gt; &lt;/li&gt;
              &lt;li&gt;&lt;a href="refresher3.html"&gt;Contact&lt;/a&gt; &lt;/li&gt;
              &lt;/h3&gt;
  
  
  
          &lt;!--   &lt;meta name="ROBOTS" content="NOINDEX, NOFOLLOW" /&gt; --&gt;
  
  &lt;!-- HTML for SEARCH BAR --&gt;
  &lt;div&gt;
      &lt;form id="tfnewsearch" method="get" action="http://www.google.com"&gt;
              &lt;input type="text" class="tftextinput" name="q" size="21" maxlength="120"&gt;&lt;input type="submit" value="search" class="tfbutton"&gt;
      &lt;/form&gt;
  &lt;div class="tfclear"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
          &lt;div id="content"&gt; 
  
  
  
              &lt;?php
                  //connect to the server and create database.
                  $host = "";
                  $userMS = "";
                  $passwordMS = "";
                  $connection = mysql_connect($host,$userMS,$passwordMS) or die("Couldn't  connect:".mysql_error());
                  $database = "projectDataBase";
                  $db = mysql_select_db($database,$connection) or die("Couldn't select database");
  
  
                  //build the table to show the records.
                  echo("&lt;table&gt;");
                  echo("&lt;tr&gt;
                          &lt;th&gt;Product ID&lt;/th&gt;
                          &lt;th&gt;Product Name&lt;/th&gt;
                          &lt;th&gt;Product Image&lt;/th&gt;
                          &lt;th&gt;Age&lt;/th&gt;
                          &lt;th&gt;Stauts&lt;/th&gt;
                          &lt;th&gt;Price&lt;/th&gt;
                      &lt;/tr&gt;");
  
                      //database query to show all the records.
                  $selectString = "SELECT 
  Product.Product_ID,
  Product.Product_Name,
  Product.Image,
  Gender.Gender_Description,
  Category.Description,
  `Status`.Availability,
   Product.Price,
   Age.Age_Description
  
  
      FROM
      Product
  JOIN
      Age ON Product.Age_ID = Age.Age_ID
  JOIN
      Category ON Product.Category_ID = Category.Category_ID
  JOIN
      Gender ON Product.Gender_ID = Gender.Gender_ID
  JOIN
      `Status` ON Product.Status_ID = `Status`.Status_ID
                                ";
  
  
                  $result = mysql_query($selectString);
  
                      while ($row = mysql_fetch_assoc($result))
                      {
                      echo("&lt;tr&gt;");
                      foreach($row as $index=&gt;$value)
                      //to show the Product image.
                      if($index == "Image")
                      {
  
                          echo("&lt;td&gt;&lt;img src = $value alt = 'Image'&gt;&lt;/td&gt;");
  
                      }
                      else{
                          echo("&lt;td&gt;$value&lt;/td&gt;");                    
  
                      }
  
                      $self = htmlentities($_SERVER['PHP_SELF']);
                          echo("&lt;form action = '$self' method='POST'&gt;");
                          echo "&lt;input type='hidden' name='athID' value='$row[Product_ID]' &gt;";
                          /*echo("&lt;td&gt;&lt;input type='submit' name='delete' value = 'Delete'/&gt;&lt;/td&gt;");*/
                          echo ("&lt;/form&gt;");
                          echo("&lt;/tr&gt;");  
  
                      echo("&lt;/tr&gt;");  
                  }
                  echo("&lt;/table&gt;");
  
  
  
                  /*
                  echo("&lt;table&gt;");
          echo("&lt;tr&gt;
                  &lt;th&gt;Country Code&lt;/th&gt;
                  &lt;th&gt;Country Name&lt;/th&gt;
                  &lt;th&gt;Population&lt;/th&gt;
                  &lt;th&gt;Image&lt;/th&gt;
              &lt;/tr&gt;");
  
          $selectString = "SELECT * from tblCountries";
          $result = mysql_query($selectString);
  
              while($row = mysql_fetch_assoc($result))
              {
              echo("&lt;tr&gt;");
              foreach($row as $index=&gt;$value)
              //to show the country image.
              if($index == "flag_image")
              {
                  echo("&lt;td&gt;&lt;img src = $value alt = 'countryImage'&gt;&lt;/td&gt;");
              }
              else{
                  echo("&lt;td&gt;$value&lt;/td&gt;");                    
  
              }
              echo("&lt;/tr&gt;");  
          }
          echo("&lt;/table&gt;");
  
  
          */
  
                  mysql_free_result($result);
  
  
  
  
  
              ?&gt;
  
          &lt;/div&gt;
  
  
  
          &lt;footer&gt;Copyright © Hucos Pucos Shop&lt;/footer&gt;
  
  
  &lt;/div&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>the image is stored in Product Table.</p>