Note that there are some explanatory texts on larger screens.

plurals
  1. POExport my data from a combination of MySQL tables as Excel
    primarykey
    data
    text
    <p>I know how to export a MySQL TABLE as Excel. But my problem is that I have a complex scenario whereby I am able to get data from multiple MySQL tables and arrange them onto a HTML table output. My question is: how can I get this data output as Excel?</p> <p>Here is my code</p> <pre><code>&lt;?php include(".../dbconnect.txt"); $result = mysql_query("select * from main_table where jobid='".$_GET['jobid']."'") or die(mysql_error()); ?&gt; &lt;table width='1450'&gt; &lt;tr&gt; &lt;td&gt;S/N&lt;/td&gt; &lt;td&gt;Job Title&lt;/td&gt; &lt;td&gt;Applicant&lt;/td&gt; &lt;td&gt;Date&lt;/td&gt; &lt;td&gt;Expe&lt;/td&gt; &lt;td&gt;Course&lt;/td&gt; &lt;td&gt;Email&lt;/td&gt; &lt;td&gt;Quali&lt;/td&gt; &lt;td&gt;Age&lt;/td&gt; &lt;td&gt;Gender&lt;/td&gt; &lt;/tr&gt; &lt;?php $cnt =1; while($row = mysql_fetch_array($result)){ $count = $cnt; $cnt++; ?&gt; &lt;tr&gt; &lt;td&gt; &lt;?php echo $count; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php $re = mysql_query("select * from table1 where id='".$_GET['jobid']."'") or die(mysql_error()); $rw = mysql_fetch_array($re); echo $rw['title']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php $re1 = mysql_query("select * from table2 where email='".$row['email']."'") or die(mysql_error()); $rw1 = mysql_fetch_array($re1); echo ucwords($rw1['fname']); echo "&amp;nbsp;"; echo ucwords($rw1['lname']); ?&gt; &lt;/td&gt; &lt;td&gt;&lt;?php echo $row['date']; ?&gt;&lt;/td&gt; &lt;td&gt; &lt;?php $re2 = mysql_query("select * from table3 where email='".$row['email']."'") or die(mysql_error()); $rw2 = mysql_fetch_array($re2); echo $rw2['years']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php $re3 = mysql_query("select * from table4 where email='".$row['email']."'") or die(mysql_error()); $rw3 = mysql_fetch_array($re3); echo ucwords($rw3['course']); ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php echo $row['email']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php echo $rw3['quali']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php echo $rw1['age']; ?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php echo $rw1['gender']; ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt; &lt;/table&gt; </code></pre> <p>The HTML result is something like this:</p> <pre><code>S/N Job Title Applicant Date Expe Course Email Quali Age Gender 1 Program Officer - Clinical Services Username Surname Wed 31, Jul, 2013 1 Agricultural Engineering useremail@yahoo.com BEng 24 Male 2 Program Officer - Clinical Services Username Surname Wed 31, Jul, 2013 3 Political Science useremail@gmail.com BSc 33 Male 3 Program Officer - Clinical Services Username Surname Wed 31, Jul, 2013 1 Microbiology useremail@yahoo.com HND 25 Female </code></pre> <p>How to output this table in Excel instead?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload