if i use this code to display data from database,
function reportExcel()
{
$user = $this->session->userdata('username');//user print
$awal = $this->input->post('tglawal');//tanggal awal
$akhir = $this->input->post('tglakhir');//tanggal akhir
$suplier = $this->input->post('suplier');//suplier
$userord = $this->input->post('userord');//suplier
$ket = $this->input->post('ket');//keterangan
$status = $this->input->post('status');//status
$query = 'select * from porder where tgl_po >= "'.$awal.'" and tgl_po <= "'.$akhir.'" and lower(suplier) like ("%'.$suplier.'%") and lower(username) like lower("%'.$userord.'%") and lower(status) like lower("%'.$status.'%") and lower(keterangan) like lower("%'.$ket.'%") ';
if ($result = mysql_query($query)) {
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo "<pre>";
echo $row['no_po'];
$query_det = "SELECT * FROM pordet a, preq b WHERE a.no_req = b.no_req and a.no_po ='".$row["no_po"]."'";
// BAGIAN 2
$result_det = mysql_query($query_det);
while ($rowdet = mysql_fetch_array($result_det, MYSQL_ASSOC)) {
echo $rowdet['no_req'];
//BAGIAN 3
}
}
}
}
any data from the orders table related to table request
then how to put the data on the table after the data request from the table order on PHPExcel like the picture above