I want to put data in array which then put in excel file but it does not work.
$sql="SELECT `Jobc_id`, `Customer_name`, `Veh_reg_no`, `MSI_cat`, `Mileage` FROM `jobcard`";
$result = $conn->query($sql);
while($row = $result->fetch_assoc()){
array( $row["job_id"],$row["Customer_name"],$row["Veh_reg_no"],$row["MSI_cat"],$row["Mileage"]);
}
foreach($rows as $row)
$writer->writeSheetRow('Sheet1', $row);
Whereas, below code work..
$rows = array(
array('2003','1','-50.5','2010-01-01 23:00:00','2012-12-31 23:00:00'),
array('2003','B1', '23.5','2010-01-01 00:00:00','2012-12-31 00:00:00'),
);
foreach($rows as $row)
$writer->writeSheetRow('Sheet1', $row);
How can I make first code to work :( pls help
$rowsin your first code?