Skip to main content

Posts

Showing posts from August, 2016

Query Surat Dekan

//query surat dekan  $q = "SELECT surat_dekan_fakultas, surat_dekan_nomor, surat_dekan_tanggal FROM surat_dekan WHERE surat_dekan_thsms ='20161'";  $h = $link->query($q) or die($link->error);  $i = 0;  while($d=$h->fetch_array()){   $cell[$i][0]=$d[0];   $cell[$i][1]=$d[1];   $cell[$i][2]=$d[2];   $i++;  }  //perulangan untuk membuat tabel  for($j=0;$j<$i;$j++){   $pdf->Cell(1.35);   $pdf->Cell(0.2,0.2,$j+2 .'.','',0,'C');   $tgl_surat_dekan_indo = TanggalIndo($cell[$j][2]);   $pdf->Cell(3,0.2,'Surat Dekan '. $cell[$j][0] . ' Nomor '. $cell[$j][1] . ', tanggal ' . $tgl_surat_dekan_indo,'',0,'L');   $pdf->Ln(0.15); //spasi surat dekan  }  

Fungsi Konversi Hijriyah

<?php function makeInt($angka) { if ($angka < -0.0000001) { return ceil($angka-0.0000001); } else { return floor($angka+0.0000001); } } function konvhijriah($tanggal) { $array_bulan = array("Muharram", "Safar", "Rabiul Awwal", "Rabiul Akhir", "Jumadil Awwal","Jumadil Akhir", "Rajab", "Sya’ban", "Ramadhan","Syawwal", "Zulqaidah", "Zulhijjah"); $date = makeInt(substr($tanggal,8,2)); $month = makeInt(substr($tanggal,5,2)); $year = makeInt(substr($tanggal,0,4)); if (($year>1582)||(($year == "1582") && ($month > 10))||(($year == "1582") && ($month=="10")&&($date >14))) { $jd = makeInt((1461*($year+4800+makeInt(($month-14)/12)))/4)+ makeInt((367*($month-2-12*(makeInt(($month-14)/12))))/12)- makeInt( (3*(makeInt(($year+4900+makeInt(($month-14)/12))/100))) /4)+ $date-32075; } else { $jd = 367*$year-makeInt(

Import dari XLS ke PHP

Download excel_reader2.php <?php ini_set("display_errors",0); require_once 'excel_reader2.php'; define('DB_SERVER', 'localhost'); define('DB_USERNAME', 'root'); define('DB_PASSWORD', ''); define('DB_DATABASE', 'simpeg'); $connection = mysqli_connect(DB_SERVER,DB_USERNAME,DB_PASSWORD,DB_DATABASE); $data = new Spreadsheet_Excel_Reader("sks20161.XLS"); echo "Total Sheets in this xls file: ".count($data->sheets)."<br /><br />"; $html="<table border='0'>"; for($i=0;$i<count($data->sheets);$i++) // Loop to get all sheets in a file. { if(count($data->sheets[$i][cells])>0) // checking sheet not empty { echo "Sheet $i:<br /><br />Total rows in sheet $i  ".count($data->sheets[$i][cells])."<br />"; for($j=1;$j<=count($data->sheets[$i][cells]);$j++) // loop

Merubah Tanggal

//rubah tanggal ke tahun ---- function rubah_tgl_th($th) {     $exp = explode('-',$th);     if (count($exp) == 3)     {         $th =$exp[0];     }     return $th; } //rubah tanggal ke bulan ---- function rubah_tgl_bl($bl) {     $exp = explode('-',$bl);     if (count($exp) == 3)     {         $bl =$exp[1];     }     return $bl; } //fungsiromawi function Romawi($n){  $hasil = '';  $iromawi = array('','I','II','III','IV','V','VI','VII','VIII','IX','X',20=>'XX',30=>'XXX',40=>'XL',50=>'L', 60=>'LX',70=>'LXX',80=>'LXXX',90=>'XC',100=>'C',200=>'CC',300=>'CCC',400=>'CD',500=>'D',600=>'DC',700=>'DCC', 800=>'DCCC',900=>'CM',1000=>'M',2000=>'MM',3000=>'MMM'); if(array_
SQL INSERT INTO SELECT Statement « Previous Next Chapter » With SQL, you can copy information from one table into another. The INSERT INTO SELECT statement copies data from one table and inserts it into an existing table. The SQL INSERT INTO SELECT Statement The INSERT INTO SELECT statement selects data from one table and inserts it into an existing table. Any existing rows in the target table are unaffected. SQL INSERT INTO SELECT Syntax We can copy all columns from one table to another, existing table: INSERT INTO table2 SELECT * FROM table1; Or we can copy only the columns we want to into another, existing table: INSERT INTO table2 (column_name(s)) SELECT column_name(s) FROM table1; Demo Database In this tutorial we will use the well-known Northwind sample database. Below is a selection from the "Customers" table: CustomerID CustomerName ContactName Address City PostalCode Cou

A PHP Error was encountered

Solusinya Jika menemukan error pada CodeIgniter seperti ini  A PHP Error was encountered Severity : Notice Message : Only variable references should be returned by reference Filename : core / Common . php Line Number : 257 Langsung saja buka file itu di [folder ci]/system/core/Common.php, kemudian ganti kode di baris 257 dari  return $_config [ 0 ] =& $config ;
Introduction Excel Sheet is a collection of cells where you keep and manipulate the data. In this tutorial, we will learn how to export data from Mysql Database to Excel Sheet in PHP using Codeigniter Framework. For that, we will use   PHPReport   Library. By using that library, we can easily export MySql data into Excel Sheet. Firstly, we will create a database,   student_details   and download   PHPReport library . When we database created, then we will set an Excel template. We will explain how to set Excel template below. We will also make a Controller to use the model to get data from database and export this data into Excel Sheet. Create Database To fetch data from database to insert into excel Sheet, we need to create a database. -- -- Database: `student_details` -- -- -------------------------------------------------------- -- -- Table structure for table `student` -- CREATE TABLE IF NOT EXISTS `student` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varcha