Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 18.118.144.239
<?php
/*$servername = "localhost";
$username = 'root';
$password = "";
$databse = 'cuk_convo';
$servername = "209.59.187.13";
$username = 'cukuser';
$password = "Cuk_convo_2018";
$databse = 'cuk_convo';
$conn = new mysqli($servername,$username,$password,$databse);
if(!$conn)
{
die("Connection failed: " . mysqli_connect_error());
}*/
include('database.php');
error_reporting(E_ALL);
ini_set('display_errors', 'on');
include('PHPExcel-1.8/Classes/PHPExcel.php');
include('PHPExcel-1.8/Classes/PHPExcel/Writer/Excel2007.php');
//echo $containing_dir = basename(dirname(__FILE__));
//die();
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
->setLastModifiedBy("Maarten Balliauw")
->setTitle("PHPExcel Test Document")
->setSubject("PHPExcel Test Document")
->setDescription("Test document for PHPExcel, generated using PHP classes.")
->setKeywords("office PHPExcel php")
->setCategory("Test result file");
$collcode_query = "select d.fdistname as District_Name,e.feventname as Event,s.fname as Student_Name,
date_format(s.fdob,'%d-%m-%Y') as Student_DOB ,
s.fmobileno as Student_MOB,
if(FGENDER = 'M','Male','Female') as Gender,
FAADHAR as Aadhar_no,
s.ffatname as Student_Father_Name,
concat(fsecadd1,' ',fsecadd2,' ',fsecadd3,' District : ',fdistname,' ',fsecstate,' - ',fsecpin) as School_address,
concat(FPERADD1,' ',FPERADD2,' ',FPERADD3,' District : ',FPERDIST,' ',FPERSTATE,' - ',FPERPIN) as Permanent_address,
FACCOUNT as Acount_no,FIFSC as IFSC_Code,FBANK as Bank_Name,FBRANCH as Bank_Branch,
FTEACH as Guide_Teach_Name, FTEACHMOB as Guide_Teach_MOB,FTEACHSEC as Guide_Teach_School,
FTEACHSECADD as Guide_Teach_School_Add,e.feventname as Event, FEVENTL as Event_Level,
FEVENTWD as Event_Win_date,FEVENTP as Event_Conducted_Place,
s.fphotopath
from student s inner join masevent e on s.fevent = e.feventcode
inner join masdist d on d.fdistcode = s.FENTEREDDIST
order by d.fdistname,e.feventname,s.fname";
//var_dump($collcode_query);
$result = mysqli_query($conn,$collcode_query);
$i=0;
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueByColumnAndRow(0,1,'Sl. No.')
->setCellValueByColumnAndRow(1,1,'District Name')
->setCellValueByColumnAndRow(2,1,'Event')
->setCellValueByColumnAndRow(3,1,'Name')
->setCellValueByColumnAndRow(4,1,'DOB')
->setCellValueByColumnAndRow(5,1,'MOB')
->setCellValueByColumnAndRow(6,1,'Gender')
->setCellValueByColumnAndRow(7,1,'Aadhar_No.')
->setCellValueByColumnAndRow(8,1,'Student_Father_Name')
->setCellValueByColumnAndRow(9,1,'School_address')
->setCellValueByColumnAndRow(10,1,'Permanent_address')
->setCellValueByColumnAndRow(11,1,'Acount_No.')
->setCellValueByColumnAndRow(12,1,'IFSC_Code')
->setCellValueByColumnAndRow(13,1,'Bank_Name')
->setCellValueByColumnAndRow(14,1,'Bank_Branch')
->setCellValueByColumnAndRow(15,1,'Guide_Teach_Name')
->setCellValueByColumnAndRow(16,1,'Guide_Teach_MOB')
->setCellValueByColumnAndRow(17,1,'Guide_Teach_School')
->setCellValueByColumnAndRow(18,1,'Guide_Teach_School_Add')
->setCellValueByColumnAndRow(19,1,'Event')
->setCellValueByColumnAndRow(20,1,'Event_Level')
->setCellValueByColumnAndRow(21,1,'Event_Win_date')
->setCellValueByColumnAndRow(22,1,'Event_Conducted_Place')
->setCellValueByColumnAndRow(23,1,'Photo');
//$objPHPExcel->getActiveSheet()->getRowDimension('1')->setRowHeight(100);
$i = 2;
$x = 1;
while($coll = mysqli_fetch_array($result,MYSQLI_NUM))
{
//var_dump($coll);
//echo $_SERVER['DOCUMENT_ROOT'];die();
$objPHPExcel->setActiveSheetIndex(0)
->setCellValueByColumnAndRow(0,$i,$x)
->setCellValueByColumnAndRow(1,$i,$coll[0])
->setCellValueByColumnAndRow(2,$i,$coll[1])
->setCellValueByColumnAndRow(3,$i,$coll[2])
->setCellValueByColumnAndRow(4,$i,$coll[3])
->setCellValueByColumnAndRow(5,$i,$coll[4])
->setCellValueByColumnAndRow(6,$i,$coll[5])
->setCellValueByColumnAndRow(7,$i,$coll[6])
->setCellValueByColumnAndRow(8,$i,$coll[7])
->setCellValueByColumnAndRow(9,$i,$coll[8])
->setCellValueByColumnAndRow(10,$i,$coll[9])
->setCellValueByColumnAndRow(11,$i,$coll[10])
->setCellValueByColumnAndRow(12,$i,$coll[11])
->setCellValueByColumnAndRow(13,$i,$coll[12])
->setCellValueByColumnAndRow(14,$i,$coll[13])
->setCellValueByColumnAndRow(15,$i,$coll[14])
->setCellValueByColumnAndRow(16,$i,$coll[15])
->setCellValueByColumnAndRow(17,$i,$coll[16])
->setCellValueByColumnAndRow(18,$i,$coll[17])
->setCellValueByColumnAndRow(19,$i,$coll[18])
->setCellValueByColumnAndRow(20,$i,$coll[19])
->setCellValueByColumnAndRow(21,$i,$coll[20])
->setCellValueByColumnAndRow(22,$i,$coll[21]);
$objPHPExcel->getActiveSheet()->getRowDimension($i)->setRowHeight(110);
//var_dump($coll[20]);
$n = 'X'.$i;
$coll[22] = "/home/logisys32/public_html/oasis/PrathibhaKaranji_stop/".$coll[22];
$objDrawing = new PHPExcel_Worksheet_Drawing();
$objDrawing->setName('test_img');
$objDrawing->setDescription('test_img');
$objDrawing->setPath($coll[22]);
$objDrawing->setCoordinates($n);
$objDrawing->setHeight(138);
$objDrawing->setWorksheet($objPHPExcel->getActiveSheet());
$i++;
$x++;
}
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="admission_data.xls"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be needed
header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); // always modified
header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
header ('Pragma: public'); // HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;
?>
|