dc_jt Posted November 22, 2006 Share Posted November 22, 2006 HiI have the following code which queries my database and shows results in excel.However, when i open excel to view it the name, email, address etc start on row 2 instead of 1 for some reason.Also, there is a little square at the end of each row.Any ideas how to get rid of this?Here is the code[quote]<?php require_once($_SERVER['DOCUMENT_ROOT'].'/config.inc.php'); require_once(LOCAL_CLASSES.'/Tables/RCLTblReaders.class.php'); header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=UserMemories".str_replace(' ','', $sUserMemories)."_".$sCurrentDate.".csv"); header("Pragma: no-cache"); header("Expires: 0"); $oTblReaders = new RCLTblReaders(); $rReaders = $oTblReaders->GetDataP(); print "Name, Email, Address, Town, City, Postcode, Country"; while ($oReaders = mysql_fetch_object($rReaders)) {?> <?php print "$oReaders->name, $oReaders->email, $oReaders->address, $oReaders->town, $oReaders->city, $oReaders->postcode, $oReaders->country"; }?>[/quote]Thanks Link to comment https://forums.phpfreaks.com/topic/28081-exporting-to-excel-file/ Share on other sites More sharing options...
dc_jt Posted November 23, 2006 Author Share Posted November 23, 2006 Anyone please?? Link to comment https://forums.phpfreaks.com/topic/28081-exporting-to-excel-file/#findComment-129078 Share on other sites More sharing options...
joshi_v Posted November 24, 2006 Share Posted November 24, 2006 I think problem is with the blank lines after you started outputting to XML file.Try by removing those blank lines.RegardsJoshi Link to comment https://forums.phpfreaks.com/topic/28081-exporting-to-excel-file/#findComment-129540 Share on other sites More sharing options...
dc_jt Posted November 24, 2006 Author Share Posted November 24, 2006 Ive tried removing all blank lines and still no luck ??? Link to comment https://forums.phpfreaks.com/topic/28081-exporting-to-excel-file/#findComment-129580 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.