Mapping data to new Worksheet using PHPExcel

290
July 16, 2017, at 4:34 PM

I'm having trouble in mapping my data to my new worksheet using PHPExcel.

I want to map my data on a new worksheet in A4 but somehow its not working. I tried to map it in a different column like F and it works fine. Can you give me hints on how to map my data in the correct column?

Here's my code:

$incentive = "select * from incentive";
$connect = @mysql_connect($dbhost, $dbuser, $dbpass) 
or die("Couldn't connect to MySQL:<br>" . mysql_error() . "<br>" . 
mysql_errno()); 
//select database 
$Db = @mysql_select_db($dbname, $connect) 
or die("Couldn't select database:<br>" . mysql_error(). "<br>" . 
mysql_errno()); 
//execute query 
$resultincentive = @mysql_query($incentive,$connect) 
or die("Couldn't execute query:<br>" . mysql_error(). "<br>" . 
mysql_errno()); 
error_reporting(E_ALL);
$objPHPExcel = new PHPExcel(); 
$objPHPExcel->createSheet();
$objPHPExcel->setActiveSheetIndex(1);  
$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Company Name:');
$objPHPExcel->getActiveSheet()->setCellValue('A2', 'Sales Incentive for the 
Month of:');
$objPHPExcel->getActiveSheet()->setCellValue('D1', 'Date:');
$objPHPExcel->getActiveSheet()->setCellValue('A3', 'Date');
$objPHPExcel->getActiveSheet()->setCellValue('B3', 'Total Sales');
$objPHPExcel->getActiveSheet()->setCellValue('C3', 'Sales Net of Vat');
$objPHPExcel->getActiveSheet()->setCellValue('D3', 'Sales Quota');
$objPHPExcel->getActiveSheet()->setCellValue('E3', 'Incentive Amount');
$rowCount2  = 1;
 while($rowincentive = mysql_fetch_array($resultincentive)){
 $objPHPExcel->getActiveSheet()->setCellValue('A4'.$rowCount2, 
$rowincentive['DATE']);

 $rowCount2++;
 }
 // Rename 2nd sheet
$objPHPExcel->getActiveSheet()->setTitle('Incentive');
Rent Charter Buses Company
READ ALSO
pdo query successfully run on localhost but not run on hosting

pdo query successfully run on localhost but not run on hosting

My code is below it is running on the localhost successfully but not running on hosting serveri tried many time to resolve but i am not able to solve it

212
How make group of the JSON data of same key

How make group of the JSON data of same key

I am working in phpI have the JSON data in which muliple data comes some data have two same keys as shown below

209
How to encrypt xml document type in browser game online? [on hold]

How to encrypt xml document type in browser game online? [on hold]

i have a php file that can decrypt xml/conf document typeBut when i re-encrypt them again, it's fail!! Could you show me where is wrong?? Here my code:

255