Read 213 times | Created 2013-01-22 03:46:59 | Updated 2013-01-22 03:53:22 | | |

 

<?php
/**********************************  
FILENAME  : warnet.php  
CREATE BY  : cahya dsn  
PURPOSE   : display list of continues data 
CREATE DATE : 2013-01-22
**********************************  
//table creation

USE `test`;  

DROP TABLE IF EXISTS `lokasi`;  
CREATE TABLE IF NOT EXISTS `lokasi` (  
 `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT 'primary key untuk table lokasi',  
 `nama` varchar(30) NOT NULL COMMENT 'nama warnet',
 `jenis` varchar(30) NOT NULL COMMENT 'jenis',
 `deskripsi` text NOT NULL COMMENT 'deskripsi',
 `lat` float NOT NULL DEFAULT 0.0,  
 `lng` float NOT NULL DEFAULT 0.0,  
 `nm_pemilik` varchar(30) NOT NULL COMMENT 'nama pemilik',
 `fasilitas` varchar(50) NOT NULL COMMENT 'fasilitas',
 PRIMARY KEY(`id`)  
) ENGINE=MyISAM COMMENT='tabel untuk menyimpan data lokasi';  

INSERT INTO `lokasi`(`id`,`nama`,`jenis`,`deskripsi`,`lat`,`lng`,`nm_pemilik`,`fasilitas`) 
VALUES  
(NULL,'nama1','jenis1','deskripsi1',-6.1333,106.75,'pemilik1','falisitas1'),
(NULL,'nama2','jenis2','deskripsi2',-6.1333,106.75,'pemilik2','falisitas2'),
(NULL,'nama3','jenis3','deskripsi3',-6.1333,106.75,'pemilik3','falisitas3'),
(NULL,'nama4','jenis4','deskripsi4',-6.1333,106.75,'pemilik4','falisitas4'),
(NULL,'nama5','jenis5','deskripsi5',-6.1333,106.75,'pemilik5','falisitas5'),
(NULL,'nama6','jenis6','deskripsi6',-6.1333,106.75,'pemilik6','falisitas6'),
(NULL,'nama7','jenis7','deskripsi7',-6.1333,106.75,'pemilik7','falisitas7'),
(NULL,'nama8','jenis8','deskripsi8',-6.1333,106.75,'pemilik8','falisitas8'),
(NULL,'nama9','jenis9','deskripsi9',-6.1333,106.75,'pemilik9','falisitas9'),
(NULL,'nama10','jenis10','deskripsi10',-6.1333,106.75,'pemilik10','falisitas10'),
(NULL,'nama11','jenis11','deskripsi11',-6.1333,106.75,'pemilik11','falisitas11'),
(NULL,'nama12','jenis12','deskripsi12',-6.1333,106.75,'pemilik12','falisitas12'),
(NULL,'nama13','jenis13','deskripsi13',-6.1333,106.75,'pemilik13','falisitas13'),
(NULL,'nama14','jenis14','deskripsi14',-6.1333,106.75,'pemilik14','falisitas14'),
(NULL,'nama15','jenis15','deskripsi15',-6.1333,106.75,'pemilik15','falisitas15'),
(NULL,'nama16','jenis16','deskripsi16',-6.1333,106.75,'pemilik16','falisitas16'),
(NULL,'nama17','jenis17','deskripsi17',-6.1333,106.75,'pemilik17','falisitas17'),
(NULL,'nama18','jenis18','deskripsi18',-6.1333,106.75,'pemilik18','falisitas18'),
(NULL,'nama19','jenis19','deskripsi19',-6.1333,106.75,'pemilik19','falisitas19'),
(NULL,'nama20','jenis20','deskripsi20',-6.1333,106.75,'pemilik20','falisitas20'),
(NULL,'nama21','jenis21','deskripsi21',-6.1333,106.75,'pemilik21','falisitas21'),
(NULL,'nama22','jenis22','deskripsi22',-6.1333,106.75,'pemilik22','falisitas22'),
(NULL,'nama23','jenis23','deskripsi23',-6.1333,106.75,'pemilik23','falisitas23'),
(NULL,'nama24','jenis24','deskripsi24',-6.1333,106.75,'pemilik24','falisitas24'),
(NULL,'nama25','jenis25','deskripsi25',-6.1333,106.75,'pemilik25','falisitas25'),
(NULL,'nama26','jenis26','deskripsi26',-6.1333,106.75,'pemilik26','falisitas26'),
(NULL,'nama27','jenis27','deskripsi27',-6.1333,106.75,'pemilik27','falisitas27'),
(NULL,'nama28','jenis28','deskripsi28',-6.1333,106.75,'pemilik28','falisitas28'),
(NULL,'nama29','jenis29','deskripsi29',-6.1333,106.75,'pemilik29','falisitas29'),
(NULL,'nama30','jenis30','deskripsi30',-6.1333,106.75,'pemilik30','falisitas30'),
(NULL,'nama31','jenis31','deskripsi31',-6.1333,106.75,'pemilik31','falisitas31'),
(NULL,'nama32','jenis32','deskripsi32',-6.1333,106.75,'pemilik32','falisitas32'),
(NULL,'nama33','jenis33','deskripsi33',-6.1333,106.75,'pemilik33','falisitas33'),
(NULL,'nama34','jenis34','deskripsi34',-6.1333,106.75,'pemilik34','falisitas34'),
(NULL,'nama35','jenis35','deskripsi35',-6.1333,106.75,'pemilik35','falisitas35'),
(NULL,'nama36','jenis36','deskripsi36',-6.1333,106.75,'pemilik36','falisitas36'),
(NULL,'nama37','jenis37','deskripsi37',-6.1333,106.75,'pemilik37','falisitas37'),
(NULL,'nama38','jenis38','deskripsi38',-6.1333,106.75,'pemilik38','falisitas38'),
(NULL,'nama39','jenis39','deskripsi39',-6.1333,106.75,'pemilik39','falisitas39'),
(NULL,'nama40','jenis40','deskripsi40',-6.1333,106.75,'pemilik40','falisitas40'),
(NULL,'nama41','jenis41','deskripsi41',-6.1333,106.75,'pemilik41','falisitas41'),
(NULL,'nama42','jenis42','deskripsi42',-6.1333,106.75,'pemilik42','falisitas42'),
(NULL,'nama43','jenis43','deskripsi43',-6.1333,106.75,'pemilik43','falisitas43'),
(NULL,'nama44','jenis44','deskripsi44',-6.1333,106.75,'pemilik44','falisitas44'),
(NULL,'nama45','jenis45','deskripsi45',-6.1333,106.75,'pemilik45','falisitas45'),
(NULL,'nama46','jenis46','deskripsi46',-6.1333,106.75,'pemilik46','falisitas46'),
(NULL,'nama47','jenis47','deskripsi47',-6.1333,106.75,'pemilik47','falisitas47'),
(NULL,'nama48','jenis48','deskripsi48',-6.1333,106.75,'pemilik48','falisitas48'),
(NULL,'nama49','jenis49','deskripsi49',-6.1333,106.75,'pemilik49','falisitas49'),
(NULL,'nama50','jenis50','deskripsi50',-6.1333,106.75,'pemilik50','falisitas50'),
(NULL,'nama51','jenis51','deskripsi51',-6.1333,106.75,'pemilik51','falisitas51'),
(NULL,'nama52','jenis52','deskripsi52',-6.1333,106.75,'pemilik52','falisitas52'),
(NULL,'nama53','jenis53','deskripsi53',-6.1333,106.75,'pemilik53','falisitas53'),
(NULL,'nama54','jenis54','deskripsi54',-6.1333,106.75,'pemilik54','falisitas54'),
(NULL,'nama55','jenis55','deskripsi55',-6.1333,106.75,'pemilik55','falisitas55'),
(NULL,'nama56','jenis56','deskripsi56',-6.1333,106.75,'pemilik56','falisitas56'),
(NULL,'nama57','jenis57','deskripsi57',-6.1333,106.75,'pemilik57','falisitas57'),
(NULL,'nama58','jenis58','deskripsi58',-6.1333,106.75,'pemilik58','falisitas58'),
(NULL,'nama59','jenis59','deskripsi59',-6.1333,106.75,'pemilik59','falisitas59'),
(NULL,'nama60','jenis60','deskripsi60',-6.1333,106.75,'pemilik60','falisitas60'),
(NULL,'nama61','jenis61','deskripsi61',-6.1333,106.75,'pemilik61','falisitas61'),
(NULL,'nama62','jenis62','deskripsi62',-6.1333,106.75,'pemilik62','falisitas62'),
(NULL,'nama63','jenis63','deskripsi63',-6.1333,106.75,'pemilik63','falisitas63'),
(NULL,'nama64','jenis64','deskripsi64',-6.1333,106.75,'pemilik64','falisitas64'),
(NULL,'nama65','jenis65','deskripsi65',-6.1333,106.75,'pemilik65','falisitas65'),
(NULL,'nama66','jenis66','deskripsi66',-6.1333,106.75,'pemilik66','falisitas66'),
(NULL,'nama67','jenis67','deskripsi67',-6.1333,106.75,'pemilik67','falisitas67'),
(NULL,'nama68','jenis68','deskripsi68',-6.1333,106.75,'pemilik68','falisitas68'),
(NULL,'nama69','jenis69','deskripsi69',-6.1333,106.75,'pemilik69','falisitas69'),
(NULL,'nama70','jenis70','deskripsi70',-6.1333,106.75,'pemilik70','falisitas70'),
(NULL,'nama71','jenis71','deskripsi71',-6.1333,106.75,'pemilik71','falisitas71'),
(NULL,'nama72','jenis72','deskripsi72',-6.1333,106.75,'pemilik72','falisitas72'),
(NULL,'nama73','jenis73','deskripsi73',-6.1333,106.75,'pemilik73','falisitas73'),
(NULL,'nama74','jenis74','deskripsi74',-6.1333,106.75,'pemilik74','falisitas74'),
(NULL,'nama75','jenis75','deskripsi75',-6.1333,106.75,'pemilik75','falisitas75'),
(NULL,'nama76','jenis76','deskripsi76',-6.1333,106.75,'pemilik76','falisitas76'),
(NULL,'nama77','jenis77','deskripsi77',-6.1333,106.75,'pemilik77','falisitas77'),
(NULL,'nama78','jenis78','deskripsi78',-6.1333,106.75,'pemilik78','falisitas78'),
(NULL,'nama79','jenis79','deskripsi79',-6.1333,106.75,'pemilik79','falisitas79'),
(NULL,'nama80','jenis80','deskripsi80',-6.1333,106.75,'pemilik80','falisitas80'),
(NULL,'nama81','jenis81','deskripsi81',-6.1333,106.75,'pemilik81','falisitas81'),
(NULL,'nama82','jenis82','deskripsi82',-6.1333,106.75,'pemilik82','falisitas82'),
(NULL,'nama83','jenis83','deskripsi83',-6.1333,106.75,'pemilik83','falisitas83'),
(NULL,'nama84','jenis84','deskripsi84',-6.1333,106.75,'pemilik84','falisitas84'),
(NULL,'nama85','jenis85','deskripsi85',-6.1333,106.75,'pemilik85','falisitas85'),
(NULL,'nama86','jenis86','deskripsi86',-6.1333,106.75,'pemilik86','falisitas86'),
(NULL,'nama87','jenis87','deskripsi87',-6.1333,106.75,'pemilik87','falisitas87'),
(NULL,'nama88','jenis88','deskripsi88',-6.1333,106.75,'pemilik88','falisitas88'),
(NULL,'nama89','jenis89','deskripsi89',-6.1333,106.75,'pemilik89','falisitas89'),
(NULL,'nama90','jenis90','deskripsi90',-6.1333,106.75,'pemilik90','falisitas90'),
(NULL,'nama91','jenis91','deskripsi91',-6.1333,106.75,'pemilik91','falisitas91'),
(NULL,'nama92','jenis92','deskripsi92',-6.1333,106.75,'pemilik92','falisitas92'),
(NULL,'nama93','jenis93','deskripsi93',-6.1333,106.75,'pemilik93','falisitas93'),
(NULL,'nama94','jenis94','deskripsi94',-6.1333,106.75,'pemilik94','falisitas94'),
(NULL,'nama95','jenis95','deskripsi95',-6.1333,106.75,'pemilik95','falisitas95'),
(NULL,'nama96','jenis96','deskripsi96',-6.1333,106.75,'pemilik96','falisitas96'),
(NULL,'nama97','jenis97','deskripsi97',-6.1333,106.75,'pemilik97','falisitas97'),
(NULL,'nama98','jenis98','deskripsi98',-6.1333,106.75,'pemilik98','falisitas98'),
(NULL,'nama99','jenis99','deskripsi99',-6.1333,106.75,'pemilik99','falisitas99'),
(NULL,'nama100','jenis100','deskripsi100',-6.1333,106.75,'pemilik100','falisitas100');
*/
//include core
include "fpdf17/fpdf.php";
//
//database configuration  
$dbhost='localhost';  
$dbuser='root';  
$dbpass='';  
$dbname='test';  
//database connection  
$db=new mysqli($dbhost,$dbuser,$dbpass,$dbname); 
//untuk inisial

$pdf = new FPDF();
$pdf->AddPage();
//untuk judul table, bisa diganti
$pdf->setFont('Arial','B',8);
$pdf->setXY(80,10); $pdf->cell(30,6,'Data Statistik Persebaran Warnet di Kota Pontianak');
$pdf->setFont('Arial','B',10);
$y= 31;
$y_axis1 = 25;
$pdf->setFont('Arial','',8);
$pdf->setFillColor(233,233,233);
$pdf->setY($y_axis1);
$pdf->setX(25);
//untuk nama field, bisa diganti
$pdf->cell(5,6,'No',1,0,'C',1); 
$pdf->cell(25,6,'Nama Warnet',1,0,'C',1); 
$pdf->cell(10,6,'Jenis',1,0,'C',1);
$pdf->cell(40,6,'Deskripsi',1,0,'C',1); 
$pdf->cell(20,6,'Lat',1,0,'C',1); 
$pdf->cell(20,6,'Lng',1,0,'C',1); 
$pdf->cell(20,6,'Pemilik',1,0,'C',1);
$pdf->cell(40,6,'Fasilitas',1,0,'C',1);  
//untuk query database, bisa diganti
$result = $db->query("SELECT * FROM lokasi");
$no = 0;
$row = 6;
//untuk menampilkan data, bisa diganti
$pdf->SetAutoPageBreak(false,20);
while ($daftar = $result->fetch_array()){
	$no++;
	$pdf->setXY(25,$y);
	$pdf->cell(5,6,$no,1,0,'C');
	$pdf->cell(25,6,$daftar['nama'],1,0,'L');
	$pdf->cell(10,6,$daftar['jenis'],1,0,'C');
	$pdf->cell(40,6,$daftar['deskripsi'],1,0,'L');
	$pdf->cell(20,6,$daftar['lat'],1,0,'C');
	$pdf->cell(20,6,$daftar['lng'],1,0,'C');
	$pdf->cell(20,6,$daftar['nm_pemilik'],1,0,'L');
	$pdf->cell(40,6,$daftar['fasilitas'],1,0,'L');
	if($no%40==0){ $pdf->AddPage();$y=31; }
	$y+=$row;
}
$result->close();
$db->close();
$pdf->Output();
?>