Page 1 of 1

Selecting All Rows, Displaying Only One

Posted: Wed Aug 09, 2006 10:39 am
by ibanez270dx
Hi,
I have a web application that stores downtime data for aircraft. The DB works very well, but I have decided to add another feature - exporting
downtime logs (according to month) to Excel. For this, I used a script called "ExcelWriter" by Harish Chauhan. However, the problem I encounter
is that when I try to select multiple rows from the database, the application fails. By that I mean that it only displays one row. This is because
after every row, there is supposed to be a function that writes the info from the DB to an excel row. Take a look at the code:

Code: Select all

$therows = array("<center>$dwntime_type</center>","<center>$dwntime_date</center>","<center>$dwntime_times</center>",
"<center>$dwntime_hrs</center>","<center>$dwntime_ata</center>","<center>$dwntime_reason</center>","<center>$dwntime_solution</center>",
"<center>$dwntime_log</center>","<center>$dwntime_log_by</center>");
	}

	$excel=new ExcelWriter("$filename.xls");
	
	if($excel==false)	
		echo $excel->error;
		
	$myArr=array("<b>TITLE</b>","<b><i>$monthname, $year</i></b>");
	$excel->writeLine($myArr);

	$myArr=array("<center><b>Type</b></center>","<center><b>Date</b></center>","<center><b>Downtime</b></center>",
"<center><b>Hours Down</b></center>","<center><b>ATA</b></center>","<center><b>Discrepancy</b></center>","<center><b>Resolution</b></center>",
"<center><b>Logged</b></center>","<center><b>Logged By</b></center>");
	$excel->writeLine($myArr);
	
	$excel->writeLine($therows);

		
				
	$excel->open($filename.xls);
If I try to use .= , I get an error. I think that if I can store the rows as seperate variables, then I can get it to work.... but I don't know how to do that. Anybody know what I can do?

Thanks in advance,
- Jeff

Posted: Thu Aug 10, 2006 2:37 am
by jmut
are there no examples of how to use this package?


I have only used http://pear.php.net/package/Spreadsheet_Excel_Writer to write .xls files.
If you want to give a try with it and have problems let me know. I should be able to help you.

But the package you mentioned, any link or something?! Now idea how it works.