Tampilkan postingan dengan label PHPMySQL. Tampilkan semua postingan
Tampilkan postingan dengan label PHPMySQL. Tampilkan semua postingan

Senin, 23 Mei 2011

A little bit naugty : Reset MySQL Password on Windows



Below was reality step that have been left at MySQL Documentation How to Reset the Root Password #http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html


We need to

1. Create a text-file

2. Execute command in command prompt

3. Test the change with a login to MySQL Server
4. Guarantee it works Guys.


Kamis, 16 Desember 2010

Change MySQL ROOT Password



How Change MySQL ROOT Password? its pretty simple when using phpmyadmin, especially we using XAMMP just go to http://localhost/phpmyadmin on your browser, then choose privilege menu, then write your password like picture above.

Minggu, 14 November 2010

Print POST Array with PHP

Print POST Array with PHP
It was difficult to detect our post field without using this manner.

i feel easy to detect any error in PHP POST Array

echo '<pre>';
print_r($_POST);
echo '</pre>';


and the result

Kamis, 19 Agustus 2010

Menghapus / Delete file dengan PHP menggunakan fungsi UNLINK

Bagaimana kita dapat menghapus file dengan menggunakan bahasa pemrograman PHP? PHP telah menyediakan sebuah fungsi untuk penghapusan FILE. sayangnya saya tidak mempergunakan sebelum-sebelumnya dikarenakan sebuah keinginan untuk historical data. Namun sebaiknya file file yang datanya di dalam database terhapus sebaiknya ikut kita hapus, karena bakal memenuhkan ruang penyimpanan saja. Berikut ini adalah cara sederhana untuk Menghapus / Delete file dengan PHP menggunakan fungsi unlink() 


Kebutuhan: 
Menghapus data di database (Salah satu field data di database tersebut menyimpan nama file yang akan dihapus). File ikut terhapus dengan menyertakan fungsi unlink() di dalam syntax PHP. Data dan File Terhapus, menghemat beban database dan Disk Space. Selesai Di dalam Program


if($_GET[action]=="delete"){
// dapatkan nama file
 $sql_="select id_video, judul, file
from tb_video where id_video=$_GET[id]";
$hasil_=mysqli_query($link,$sql_);
$data_=mysqli_fetch_array($hasil_);   

//delete row
$sql = "delete from tb_video where id_video=$_GET[id]";
$hasil = mysqli_query($link,$sql);

//delete file
 if($hasil_) {
 unlink("../source/$data_[file]"); 
 }

//reload page otomatis dengan javascript
 echo "<script language=javascript>
alert('Data Berhasil Dihapus');</script>";
echo '<script type=text/javascript>
<!--
window.location = "index.php"
//-->
</script>';
}



Demikian sebuah contoh sederhana untuk Menghapus / Delete file dengan PHP menggunakan fungsi UNLINK. Semoga membantu

Jumat, 19 Maret 2010

Convert MySQL date Format to Indonesian Date Format with PHP

Below is A PHP Function to Convert MySQL date Format to Indonesian Date Format.

Example : 2010-10-10 can be 10 Oktober 2010

Below  is the Function to Convert MySQL date Format to Indonesian Date Format with PHP
javascript:void(0)

    function waktuindo($datawaktu)
    {
        $waktu=explode('-',$datawaktu);
        if ($waktu[1] == '01')  //jika 01 maka januari
            {
                $bulan='Januari';
            }
        elseif ($waktu[1] == '02')  
            {
                $bulan='Februari';
            }
        elseif ($waktu[1] == '03')  
            {
                $bulan='Maret';
            }
        elseif ($waktu[1] == '04')  
            {
                $bulan='April';
            }
        elseif ($waktu[1] == '05')  
            {
                $bulan='Mei';
            }
        elseif ($waktu[1] == '06')  
            {
                $bulan='Juni';
            }
        elseif ($waktu[1] == '07')  
            {
                $bulan='Juli';
            }
        elseif ($waktu[1] == '08')  
            {
                $bulan='Agustus';
            }
        elseif ($waktu[1] == '09')  
            {
                $bulan='September';
            }
        elseif ($waktu[1] == '10')  
            {
                $bulan='Oktober';
            }
        elseif ($waktu[1] == '11')  
            {
                $bulan='November';
            }
        elseif ($waktu[1] == '12')  
            {
                $bulan='Desember';
            }
        else  
            {
                $bulan='00';
            }
        echo"$waktu[2] $bulan $waktu[0]";
    }

  

It was a simple fuction to Convert MySQL date Format to Indonesian Date Format with PHP by myself Maybe need a correction for perfection.

Convert Date to Day PHP-MySQL Query

I Found Something Interest from forum that asked about Date to Day Conversion : It's All About Convert Date to Day PHP-MySQL Query

Is there a way to take a MySQL date in the format of yyyy-mm-dd and convert it into the format of something like "Monday, June 6".

Convert Date to Day PHP-MySQL Query, Date to Day SQL, Date to Day MySQL, Date to Day PHP MySQL
and those example above.


First I Found The Necessary thing is find day from mysql date yyyy-mm-dd format to Convert Date to Day PHP-MySQL Query.

and the way is
$query = "SELECT `date_col` AS `date_mysql`,
DATE_FORMAT(`date_col`, '%W, %M %e') AS `date_text`
FROM `table_name`";

date_col --> Column from a table contain date_format yyyy-mm-dd
table name -- MySQL Table Name
Convert Date to Day PHP-MySQL Query, Date to Day SQL, Date to Day MySQL, Date to Day PHP MySQL
After Get a Day In English : Sunday, Monday, Tuesday, Wednesday, Thursday, Friday,  and Saturday, Now We Convert into Indonesian Day : Senin, Selasa, Rabu, kamis, jumat, Sabtu, Minggu with This Syntax :

        if ($baris[date_text]=='Monday'){
            $baris[date_text]='Senin';
        }
        else if ($baris[date_text]=='Tuesday'){
            $baris[date_text]='Selasa';
        }
        else if ($baris[date_text]=='Wednesday'){
            $baris[date_text]='Rabu';
        }
        else if ($baris[date_text]=='Thursday'){
            $baris[date_text]='Kamis';
        }
        else if ($baris[date_text]=='Friday'){
            $baris[date_text]='Jumat';
        }
        else if ($baris[date_text]=='Saturday'){
            $baris[date_text]='Sabtu';
        }
        else if ($baris[date_text]=='Monday'){
            $baris[date_text]='Minggu';
        }
        else {
            $baris[date_text]='--';
        }

Ok, Well Then Just Combine The Day With
A Function that Convert Date yyyy-mm-dd to dd -month_name- yyyy

After That The Convert Result Date to Day PHP-MySQL Query Will Be Like This :


Convert Date to Day PHP-MySQL Query, Date to Day SQL, Date to Day MySQL, Date to Day PHP MySQL

Minggu, 07 Februari 2010

Reorder MySQL Table Column


Reorder MySQL Table Column? How can be happen? maybe we design a unperfect table in the first time, so we need to reorder the column.

It can be done easily by User Interface in SQL Yog,

Reorder MySQL Table, Reorder Column MySQL, Reorder Field MySQL 

Figure 1. Choose The Table

Reorder MySQL Table, Reorder Column MySQL, Reorder Field MySQL 
Figure 2. Choose the field to be Reorder.

 Reorder MySQL Table, Reorder Column MySQL, Reorder Field MySQL 
Figure 3. Field has been Reorder

Reorder MySQL Table, Reorder Column MySQL, Reorder Field MySQL 
Figure 4. Field Reorder Sucessfully


but there also any syntax can solve this problem :

ALTER table `tb_name`
MODIFY COLUMN `column_name` your_data_type
AFTER `other_column_name`

Just replace the following fields by your actual MySQL data:

* tb_name: the name of your MySQL table being modified.
* column_name: the name of the MySQL table column that you want to reorder.
* your_data_type: the MySQL data type of the data stored in the moved column, such as int, varchar(lenght), text, etc.
* other_column_name: the column name that will be just before the new position of your reordered column.


This will reorder the columns in your current MySQL table structure, but it will not alter the row order of your table records: the stored data order will remain unaltered. Reorder MySQL table columns to visually group strongly related fields. So reordering is just a way of changing the column order of an existing MySQL table, and it won't modify your query performance.

Column reorder is mainly a matter of coherence and logical organization. On the contrary, altering the stored data order may optimize (or negatively impact) such MySQL query performance.

Example by Using Syntax :

I Have a Table

CREATE TABLE `guest_book` (                             
              `id_gb` int(4) NOT NULL AUTO_INCREMENT,               
              `pengirim` varchar(20) NOT NULL DEFAULT '',           
              `email` varchar(50) NOT NULL DEFAULT '',              
              `isi` text NOT NULL,  
              `tgl1` datetime DEFAULT NULL,                              
              `tgl` datetime DEFAULT NULL,                    
              PRIMARY KEY (`id_gb`)                                 
            )

and then i use DDL syntax :

ALTER table `guest_book`
MODIFY COLUMN `tgl1` timestamp
AFTER `tgl`


(4 row(s)affected)
(0 ms taken)

You Can Check The Difference Here..



Please beware of changing datatype after the field name in second line syntax.

Rabu, 03 Februari 2010

SQL to insert Timestamp Data Type into MySQL

A timestamp is a sequence of characters, denoting the date and/or time at which a certain event occurred.

The time at which an event is recorded by a timestamp (e.g., entered into a log file) should be very, very close to the time of the occurrence of the event recorded.

example of a timestamp in mysql : 2010-02-02 18:15:37

How Using SQL to insert Timestamp Data Type into MySQL ?

(Provided Table First)

CREATE TABLE `guest_book` (                                                      
              `id_gb` int(4) NOT NULL AUTO_INCREMENT,                                        
              `pengirim` varchar(20) NOT NULL DEFAULT '',                                    
              `email` varchar(50) NOT NULL DEFAULT '',                                       
              `isi` text NOT NULL,                                                           
              `tgl` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
              PRIMARY KEY (`id_gb`)                                                          
            )

Just Running A Query


insert into guest_book
(pengirim,
email,
isi,
tgl
)
values
('pengirim',
'picas @ unud.com',
'isi',
CURRENT_TIMESTAMP
)

in the  provided table.


And The Result :
Timestamp, MySQL Timestamp, datetime query, log SQL, Catatan waktu SQL, Field Waktu MySQL, Waktu MySQL

Kamis, 21 Januari 2010

FPDF Limit File Size and Cause A Blank Error Download

According FPDF Faqs we know that : There is no particular limit of FPDF Output filesize. There are some constraints, however:

- The maximum memory size allocated to PHP scripts is usually 8MB. For very big documents, especially with images, this limit may be reached (the file being built into memory). The parameter is configured in the php.ini file.


- The maximum execution time allocated defaults to 30 seconds. This limit can of course be easily reached. It is configured in php.ini and may be altered dynamically with set_time_limit().

- Browsers generally have a 5 minute time-out. If you send the PDF directly to the browser and reach the limit, it will be lost. It is therefore advised for very big documents to generate them in a file, and to send some data to the browser from time to time (with a call to flush() to force the output). When the document is finished, you can send a redirection to it or create a link.
Remark: even if the browser times out, the script may continue to run on the server.

Dear Friends, I Have a Trouble before, and i want to share that The filesize of  FPDF Output can Cause an Error / Blank Output. Actually my maximum allocated memory was 16 MB in php.ini and size of my FPDF Output was 8 MB. This Output cause Error, So I Change my maximum allocated memory to 64 MB.

If you have change maximum allocated memory, and still not work, we can increase maximum time to run a script, default 30 Second can be changed into 60 Second.


Hope This Help My Dear Friend.

Minggu, 17 Januari 2010

Export MySQL Query to Word with PHP


After You Read Export MySQL Query to excel with PHP, maybe you also want a to Export MySQL Query to Word with PHP. Same as Export MySQL Query to Excel before, We just need to change two words.

We Just need a Connection, a Table that contain MySQL Row and This Great Script with a bit changes..


header("Content-type: application/vnd.ms-excel");

header("Content-disposition: attachment; filename=cetak_excel.xls"); // filename
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");

Change the green highlighted words to be :

header("Content-type: application/vnd.ms-word");
header("Content-disposition: attachment; filename=cetak_word.doc"); // filename
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");


Well Done You Can Produce an Word File that Export MySQL Query to word with PHP.

Kamis, 14 Januari 2010

Export MySQL Query to excel with PHP

I still need learn a lot of PHP Programming. A Reporting is Important in Information System. People usually use PDF an Excel in Reporting. Don't be confuse, it was an easy way to produce a report from mysql database with PHP Programming.

A lot of people maybe confuse how to Export MySQL Query to excel with PHP. Because we usually learn query, connection, show data and manipulation data first. A reporting is final step if we do a programming of a system development .

We Just need a Connection, a Table that contain MySQL Row and This Great Script ..


header("Content-type: application/vnd.ms-excel");

header("Content-disposition: attachment; filename=backup_ijasah.xls"); // filename
header("Pragma: no-cache");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Expires: 0");


<?php
1.Connection File
2.The Script above
3. The MySQL Table from A PHP MySQL Query : Example just produce like this :

?>


Just add the Highlighting syntax above at the top line of your coding.. (It Can be Under Include Connection.php line).

After you call your File from Web Browser You Wil Get Like This



Well Done You Can Produce an Excel File that Export MySQL Query to excel with PHP.






Selasa, 12 Januari 2010

Disable Klik Kanan dengan Javascript

Saya Mendapatkan script Disable Klik Kanan dengan Javascript ini dari seorang teman dan belum mencobanya. Dia mengatakan It work like a charm.

Saya belum percaya karena belum mencobanya. Katanya sih ditempatkan diantara tag <head> dan penutup head </head>.


<SCRIPT language=JavaScript>

var message="tulis msg anda disini";
///////////////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")

</SCRIPT>

Silakan Dicoba ya..Saya lemah di JavaScript dan jarang banget menggunakannya.




Update : Ternyata benar benar ampuh nih script. Silakan dicoba ya.. ini contoh filenya, save aja misal test.html. Masalahnya ini untuk di pemrograman sendiri...Untuk di blogger saya tidak tau caranya....Hiks..

hmmm lanjut dulu...
Tus cobain apa klik kanan berhasil dilakukan untuk melakukan copy textnya..Apa bisa dilakukan klik kanan..???


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<SCRIPT language=JavaScript>

var message="tulis msg anda disini";
///////////////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")

</SCRIPT>

</head>

<body>

aaaaaaaaaaaaaa
</body>
</html>

Kamis, 07 Januari 2010

Error Code : 1235 This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'

First i made a Trigger like this..(To make an update of summary numeric field if any insert happen in one table)

DELIMITER $$

CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `update_jum_proposal` AFTER INSERT ON `tb_proposal`
FOR EACH ROW BEGIN
DECLARE NEW_VALUE int;
SELECT count(id) INTO NEW_VALUE FROM tb_proposal where tahun = new.tahun;

update tb_dwh_pengabdian set pengabdian_jum_proposal = NEW_VALUE where pengabdian_tahun=new.tahun;
END;
$$

DELIMITER ;


and then an error occured :
Error Code : 1235
This version of MySQL doesn't yet support 'multiple triggers with the same action time and event for one table'
(0 ms taken)


How this can be solved : Just add an Drop Trigger Statement


DELIMITER $$

DROP TRIGGER /*!50032 IF EXISTS */ `db_pengabdian`.`update_jum_proposal`$$

CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `update_jum_proposal` AFTER INSERT ON `tb_proposal`
FOR EACH ROW BEGIN
DECLARE NEW_VALUE int;
SELECT count(id) INTO NEW_VALUE FROM tb_proposal where tahun = new.tahun;

update tb_dwh_pengabdian set pengabdian_jum_proposal = NEW_VALUE where pengabdian_tahun=new.tahun;
END;
$$

DELIMITER ;



I Found this at http://forums.mysql.com/read.php?99,161909,162074#msg-162074.

Hope this help anyone...

Rabu, 06 Januari 2010

HTML Sticky Form, HTML Form That Remember The Value


HTML Sticky Form, What is that..? HTML Sticky Form is HTML Form That Remember The Value that has been POST or Get after a Submitting.

Have You Ever doing a inputting data in a web information system that has so many field to input.
How about a failure to input the data, I mean a connection failure or our input making a system denied to save the data?? We will a little bit angry to re-enter the data from the beginning.

A PHP Programmer usually know about this technique because very simple. It is very important if we develop a user friendly information system. But usually we are lazy to do that..wait, wait and until the system implementation many protest from the user.

We must prepare about this condition, so if there any time to make the HTML Form become HTML Sticky Form, just do it.

A simple way to make HTML Sticky Form is adding a value in the HTML Element

echo"<input name=\"nama\" type=\"text\" size=\"40\" value=\"$_POST[nama]\" $readonly />";

or more simple HTML Syntax, that using

<input name=nama type=text size=40 value=<?php echo"$_POST[nama]"; > >

Remember the form action, if the action was post use POST in the HTML elemen (form above using post method). You can also use get method, just change
$_POST[nama] with $_GET[nama].


Senin, 04 Januari 2010

Trigger After Delete on MySQL

It quite difficult to hear somebody explain about Trigger or Stored Procedure inDatabase Management System (DBMS). But step by step we learn, we can do it.

In this Simple Post, I'll try to make an easy Trigger After Deleting data on MySQL.

The Process Was a Copying into a table : If Any Row Delete happen in Main Table, Trigger a Copy Row into a Table named like Tbl_Deleted.

Below Was The Trigger.

DELIMITER $

DROP TRIGGER /*!50032 IF EXISTS */ `db_wisuda`.`del_biodata`$$

CREATE
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `del_biodata` AFTER DELETE ON `tb_name`
FOR EACH ROW BEGIN
delete from tb_user where username = old.nim;

insert into tb_name_del
(id,
name,
terbaik,
nopenanda
)
values
(old.idbiodata,
old.name,
old.terbaik,
old.nopenanda
);
END;
$$

DELIMITER ;


The Process was simple, If delete happen in tb_name, delete the users in tb_user and copy the data that has been deleted to tb_name_del.

Old mean the table that has been delete.
You can see username=old.nim

i have the tb_user that the tb_user username = tb_name.nim

Senin, 28 Desember 2009

Email To Image With PHP to reduce Spam

Email To Image

The number of spam emails coming into an email account is usually due to installing an email with a direct plaintext on web page. Well, to help reduce the power of email search engine we will work with the captcha principles, which boot machine or robot can not read into the image. Now we try to display our email in the form of images like services at big website such as Facebook (Email Account Info of Facebook is in form of image).

Email To Image With PHP to reduce Spam can be done with two files. The Engine File to Convert Email To Image i named
emailtoimage.php ;

<?php
header("Content-type: image/png");
// Your email address which will be shown in the image
$email = "$_GET[email]";
$length = (strlen($email)*8);
$im = @ImageCreate ($length, 20)
or die ("Kann keinen neuen GD-Bild-Stream erzeugen");
$background_color = ImageColorAllocate ($im, 255, 255, 255); // White: 255,255,255
$text_color = ImageColorAllocate ($im, 55, 103, 122);
imagestring($im, 3,5,2,$email, $text_color);
imagepng ($im);
?>



and the other one is a Common File to Call the Image.

Email To ImageHow we call the image from the common file ?
Simple, Just Use : Email : <img src=emailtoimage.php?email=$data[email]>

Jumat, 18 Desember 2009

Backup MySQL Database as SQL File with PHP


Backup MySQL Database as SQL File can be done with PHP Programming. It wasn't new thing for the expert. Backup MySQL Database as SQL File can be an alternative programming if something wrong (with server acces Telnet access, or PHPMyadmin). so the better thing we prepare is a backup programming MySQL Database as SQL File with PHP.

A simple way to do this is using a PHP Class to Backup MySQL Database as SQL. But we will got some times to search. Simply use code provide below will help us to do any Backup MySQL Database as SQL File.

The result of the Class is a SQL file with named set in the Class. The SQL File contain all Table as a data definition language (DDL) and data manipulation language (DML).

You need just provide a mysql connection in connection file, example here, i use mysqli_connect

$link=mysqli_connect($server, $username, $password, $database);


<?php
require_once('../include/koneksi.php');
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=
". "kkkk". date('Ymd'). ".sql ");
header("Content-Transfer-Encoding: binary ");


echo "create database if not exists `db_wisuda`;\r\n";
echo "\r\n";
echo "use `db_wisuda`;\r\n";
echo "\r\n";
$m = "SHOW TABLE STATUS FROM db_wisuda";
$n = mysqli_query($link,$m);

while ($datao = mysqli_fetch_array($n))
{
$table=$datao[0];
echo "/*Table structure for table `$table` */\r\n";
echo "\r\n";
echo "DROP TABLE IF EXISTS `$table`;\r\n";
echo "\r\n";
echo "CREATE TABLE `$table` (\r\n";
$sql0="desc $table";
$res0= mysqli_query($link,$sql0);
$jum0=mysqli_num_rows($res0);
$j=0;
$key=0;
while($row0= mysqli_fetch_row($res0)){
$j++;
if($jum0==$j and $key==0)
{
if($row0[2]=='NO')
{
echo "`$row0[0]` $row0[1] NOT NULL);\r\n";
}
else
{
echo "`$row0[0]` $row0[1] default NULL);\r\n";
}
}
else
{
if($row0[2]=='NO')
{
echo "`$row0[0]` $row0[1] NOT NULL,\r\n";
}
else
{
echo "`$row0[0]` $row0[1] default NULL,\r\n";
}
}
if($row0[3]=='PRI')
{
$key=$key+1;
}
}
$sql1= "desc $table";
$res1= mysqli_query($link,$sql1);
$k=0;
while ($row1= mysqli_fetch_row($res1))
{
if($row1[3]=='PRI')
{
$k++;
if($key-1==0)
{
echo "PRIMARY KEY (`$row1[0]`)\r\n";
echo ");\r\n";
}
else if($k>1 and $k<$key)
{
echo "`$row1[0]`,";
}
else if($k==$key)
{
echo "`$row1[0]`)\r\n";
echo ");\r\n";
}
else
{
echo "PRIMARY KEY (`$row1[0]`,";
}
}
}
echo "\r\n";
$sql= "SELECT * FROM $table";
$res= mysqli_query($link,$sql);
while($row= mysqli_fetch_row($res)){
echo "INSERT INTO `$table` VALUES('".implode("','",$row)."');\r\n";
}
}
echo "\r\n";
?>



Selasa, 08 Desember 2009

HTML Tag Base FPDF Text Formatting

Here is the Information About the HTML Tag Base FPDF Text Formatting. Sometimes we want to do formating Text in our FPDF Document Output. So we need simple way to do the Text Formatting.

Example :

Telah Menyelesaikan dengan baik serta memenuhi semua persyaratan pendidikan pada Fakultas Teknik, Program Studi Teknik Elektro. Oleh karena itu kepadanya diberikan gelar akademik : Sarjana Teknik, beserta segala hak dan kewajiban yang melekat pada gelar tersebut.

The Simple Way to do this is HTML Tag Base FPDF Text Formatting. Process or Convert HTML to do The Formating Text, So It can be the output of FPDF PHP Programming.

Here is The Source of Code That we can Follow : http://www.fpdf.de/downloads/addons/41/

and the output will be :

HTML Tag Base, FPDF Text Formatting

Good Browser for FPDF PHP Programming

Google Chrome is a Good Browser for FPDF PHP Programming. Good Browser for FPDF PHP Programming i mean here is easy for Debugging. We Just Need to Reload or Refresh the Browser. Without closing and open new tab to do the debugging.


I Found Moziila Firefox (Up to 3.5 ) isn't a Good Browser for FPDF PHP Programming. Because we need to close and open new tab to do the debugging.

So If You want the Browser for FPDF PHP Programming. You should use Google Chrome (I Use Version 3.0...).

Sabtu, 14 November 2009

Menghitung Umur / Usia dengan PHP

Menghitung Umur / Usia dengan PHP dapat dilakukan dengan cara yg panjang atau cara yang pendek. Menghitung Umur / Usia sering digunakan pada aplikasi sistem informasi. Beberapa aplikasi yang menggunakan Perhitungan Umur / Usia dengan PHP adalah Sistem Informasi berbasis Web.

Menghitung Umur / Usia biasanya dilakukan secara otomatis oleh program. Beberapa Pendaftaran CPNS Departemen Departemen yang dilakukan secara online menggunakan Perhitungan Umur / Usia, agar Calon Pendaftar yang sudah lewat umurnya atau belum cukup umur tidak dapat mendaftarkan dirinya..

berikut contoh syntax Menghitung Umur / Usia dengan PHP, dilakukan dengan cara singkat dan tanpa pikir panjang anda dapat menerapkannya..
[source : http://drewd.com/2006/11/03/calculating-age-in-php]


<?php
$birthdate = '1987-04-11';
$age = ((time() - strtotime($birthdate))/(60*60*24*365.2425));
echo"$age";
?>

Semoga Berhasil..