how to set cordinate like this if data from database
I have two tables : table order , table request I want to show the table as in the picture on request table are the primary key of the table orders how should I determine the coordinates on PHPExcel I appreciate your help
You can use <table>
to show table . Read excell file as this example
enter code hereinclude 'Classes/PHPExcel/IOFactory.php';
$inputFileName = 'index.xlsx';
// Read your Excel workbook
try {
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
} catch (Exception $e) {
die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME)
. '": ' . $e->getMessage());
}
// Get worksheet dimensions
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
// Loop through each row of the worksheet in turn
for ($row = 1; $row <= $highestRow; $row++) {
// Read a row of data into an array
$rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row,
NULL, TRUE, FALSE);
Then add these data to the your html table that is depend on your table requrement. This is only some introduction . If you have any problem comment here
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