Ray - 2010-01-30 01:14:23
I read the class again and realized that I needed to make my array an associative array. Here's my code:
===========================================================
// Now let's dump the data to an excel file
$assoc = array();
for ($k = 0; $k <= $i; $k++) {
$assoc[$k] = array();
$assoc[$k]["Log ID"] = $row[$k][0];
$assoc[$k]["Location"] = $row[$k][1];
$assoc[$k]["Facility"] = $row[$k][2];
$assoc[$k]["Short Name"] = $row[$k][3];
$assoc[$k]["Equip ID"] = $row[$k][4];
$assoc[$k]["Interval"] = $row[$k][5];
$assoc[$k]["Earliest"] = $row[$k][6];
$assoc[$k]["Scheduled"] = $row[$k][7];
$assoc[$k]["Latest"] = $row[$k][8];
$assoc[$k]["Order"] = $row[$k][9];
$assoc[$k]["Paragraph"] = $row[$k][10];
$assoc[$k]["Days Until Scheduled Date"] = $row[$k][11];
$assoc[$k]["Days Until Window Closes"] = $row[$k][12];
}
require_once "excel.php";
$export_file = "xlsfile://xampplite/htdocs/tools/example.xls";
$fp = fopen($export_file, "wb");
if (!is_resource($fp))
{
die("Cannot open $export_file");
}
fwrite($fp, serialize($assoc));
fclose($fp);
===========================================================
Cheers,
Ray