Archive for February, 2012

Learn to create database aplication with php

In this time I will explain that we can database application program with php. In this case we talk about php programming for build script that use database and how to use it at our project.

For example, at this time we want to create simple application for our employee, about their personal information and healthcare integration

First, we need create mysql database. At this mysql database, we can create TABLES and it fields, and make Data Integration between TABLE PEGAWAI and TABLE KESEHATAN.

For create table PEGAWAI, we can use this command :
<?php
CREATE TABLE `pegawai` ( `IDpegawai` int(10) NOT NULL auto_increment, `nama` varchar(50) NOT NULL default ”,
`alamat` varchar(32) NOT NULL default ”,
`no_telpon` varchar(32) NOT NULL default ”,
PRIMARY KEY (`IDpegawai`) ) ENGINE=MyISAM ;
?>

And for create table KESEHATAN, we can use this command :
<?php
CREATE TABLE `kesehatan` ( `IDpegawai` int(10) NOT NULL default ”, `kesehatan` varchar(50) NOT NULL default ”,
`tgl_periksa` varchar(32) NOT NULL default ” ) ENGINE=MyISAM ;
?>

For application integration, we can sort which our employees that has good health and employees that have some illness that need some treatment.

After we create table “Pegawai” and Table “kesehatan”, we need to input data into that table.
For input data, we need create form that will input data to table

For form fill table “pegawai”, we can use this command :

<?php

<form action=”inputpegawai.php” method=”post”>
Name : <input type=”text” name=”nama” />
Address : <input type=”text” name=”alamat” />
</form>

?>

And for file “inputpegawai.php” we place this code :

<?php

mysql_query( ”
insert into pegawai set
nama = ‘$_POST[nama]‘,
alamat = ‘$_POST[alamat]‘
“) or die( mysql_error() );

?>

And for table Kesehatan we can also create like how to create form input for table pegawai.

Posted on 16th February 2012
Under: general | 5 Comments »



eXTReMe Tracker

Jasa Web design, Pembuatan Website Streaming Radio