Hi guys. I am trying to setup a script which exports data into an Excel file. I am having troubles outputting arrays. It will only output the last value of an array.
I am currently using this PHP Excel class: http://code.google.com/p/php-excel/
This is the part of my code which does the exporting:
It only outputs the last value of the arrays $hostname and $description. I was playing around with the array_push() function but could not get it working properly. Any ideas how can I output whole arrays with each value in the array on a new row?
$query = "SELECT * FROM asset WHERE operational_state = 'Production' OR operational_state = 'Planned' OR operational_state = 'Expired' OR operational_state = 'Maintenance' OR operational_state = 'Repair'";
$myresult = QueryIntoArray($query);
$hostname = $myresult[$i]["hostname"];
$description = $myresult[$i]["description"];
$info = array (
1 => array ("Hostname", "Description"),
array ($hostname, $description)
// generate file (constructor parameters are optional)
$xls = new Excel_XML('UTF-8', false, 'Current Assets');