title: export images with data from Mysql to excel using php
body: <p>Am trying to export my data along side images from mysql database using php.
  The plain data is successfully exported to excel but the images donot display rather display error "the linked image cannot be displayed.The file may have been moved,renamed or deleted.Verify link points to correct file and location".</p>
  
  <p><a href="http://i.stack.imgur.com/3HJ17.png" rel="nofollow">Output of the code</a></p>
  
  <p><a href="http://i.stack.imgur.com/3HJ17.png" rel="nofollow">source code</a></p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  // The function header by sending raw excel
  header("Content-type: application/vnd-ms-excel");
   // Defines the name of the export file "codelution-export.xls"
  header("Content-Disposition: attachment; filename=system_users.xls");
   // Add data table
  include("config/dbconfig.php"); 
  ?&gt;
  &lt;!-- Image path in subfolder images --&gt;
  &lt;img src="images/reph.png" height="115" width="730"&gt; 
  &lt;table width=70% border="1" class="view"  align="center"&gt;
  
    &lt;tr&gt;&lt;th&gt; No&lt;/th&gt;
       &lt;th&gt; Name&lt;/th&gt;
  
   &lt;th&gt;User Role&lt;/th&gt;
   &lt;th&gt;User Name&lt;/th&gt;
   &lt;th&gt;Password&lt;/th&gt;
  
  &lt;/class&gt; &lt;/tr&gt;&lt;tr&gt; 
    &lt;?php
  $sno=1;
    $query=mysql_query("select * from users ");
  
    $num_rows=mysql_num_rows($query);
    if($num_rows&gt;0)
    { while ($fields=mysql_fetch_assoc($query))
     {  $sno&lt;=$num_rows; 
     $pid=$fields['user_id'];
     $lname=$fields['lname'];
    ?&gt;
     &lt;td&gt;&amp;nbsp; &lt;?php echo "$sno ";
  $sno++; ?&gt;&lt;/td&gt;
  &lt;td&gt;&amp;nbsp; &lt;?php echo $fields['lname']." ".$fields['fname'];?&gt;&lt;/td&gt;
  &lt;td&gt;&lt;?php // php code that retrieves image path from the database and prints the image
   //echo '&lt;img width="120" height="110"  SRC="' .$fields['image'] . '" alt="Image failed to load " /&gt;'; 
   ?&gt;&lt;/td&gt;
   &lt;td&gt;&amp;nbsp; &lt;?php echo $fields['role'];?&gt;&lt;/td&gt;
   &lt;td&gt;&amp;nbsp; &lt;?php echo $fields['username'];?&gt;&lt;/td&gt;
  
  &lt;td&gt;&amp;nbsp; &lt;?php echo $fields['password'];?&gt;&lt;/td&gt;
  &lt;/tr&gt;
    &lt;?php
       }//closing the while loop
      }//closing the if statement
           echo '&lt;/table&gt;';
  ?&gt;</code></pre>
  </div>
  </div>
  </p>