Skip to main content

Posts

Showing posts from December, 2016

Membuat id_pd atau reg_pd pada FEEDER

<?php //id_pd $bytes1 = random_bytes(4); $bytes2 = random_bytes(2); $bytes3 = random_bytes(2); $bytes4 = random_bytes(2); $bytes5 = random_bytes(6); $nomor= bin2hex($bytes1) . '-' . bin2hex($bytes2) . '-' . bin2hex($bytes3) . '-' . bin2hex($bytes4) . '-' . bin2hex($bytes5); echo $nomor; ?>

Double Inset dua database

<?php //mysql_connect $servername = "localhost"; $username = "root"; $password = ""; $dbname = "surat"; // Create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // Check connection  if (!$conn) {     die("Connection failed: " . mysqli_connect_error()); } //postgresql $host = "localhost"; $user = "postgres"; $pass = "........"; $db = "dikti"; $con = pg_connect("host=$host dbname=$db user=$user password=$pass")     or die ("Could not connect to server\n");     //ambil data $nomor= ""; $tanggal_agenda = $_POST["tanggal_agenda"]; function rubah_tgl_th($th) {     $exp = explode(' ',$th);     if (count($exp) == 3)     {         $th =$exp[2];     }     return $th; } //rubah tanggal ke bulan ---- function rubah_tgl_bl($bl) {     $exp = explode(' ',$bl);     if (count($exp) == 3)     {         $bl =$exp[1];     }   

XAMPP dengan Postgre SQL

1. Setting di XAMPP config di php.ini     ;extension=php_pdo_pgsql.dll     ;extension=php_pgsql.dll     hapus ; 2. Membuat koneksi: <?php $host = "localhost"; $user = "postgres"; $pass = "071002239"; $db = "dikti"; $con = pg_connect("host=$host dbname=$db user=$user password=$pass")     or die ("Could not connect to server\n"); $query = "QUERY DISINI"; $result = pg_query($con, $query);                      pg_close($con); ?>