Script PHP untuk Koneksi, Tambah & Tampil

Monday, January 14th, 2008

Berikut ini merupakan contoh script PHP untuk melakukan koneksi dari PHP ke MySQL, untuk menambah data dan menampilkan data dari database. Script ini merupakan contoh yang disampaikan pada perkuliahan Pemrograman Web 2 (PW2) di Univ. Budi Luhur Kampus Roxy.

Adapun script terdiri dari :

  1. koneksi.php, contoh script PHP untuk melakukan koneksi ke server MySQL serta memilih (membuka) salah satu database. Ubahlah script sesuai dengan kondisi komputer Anda.
  2. register.php, contoh script PHP untuk menambahkan data / record ke MySQL melalui sebuah form. Pada contoh tersebut akan ditambahkan data user.
  3. user.php, contoh script PHP untuk menampilkan data / record dari database MySQL. Script ditampilkan dalam bentuk tabel.

Download script dan databasenya di sini.

Semoga bermanfaat!

Materi PW2

Monday, December 10th, 2007

Materi Pemrograman Web 2 Pertemuan 1 dapat didownload di link di bawah ini :

Materi Pemrograman Web 2

Koneksi PHP ke MS Access dengan ODBC

Tuesday, May 1st, 2007

PHP sebagai bahasa pemrograman berbasis web berusaha memenuhi kebutuhan user dalam penyimpanan data. Saat ini, PHP sudah mendukung berbagai jenis database, seperti MySQL, PostgreSQL, Oracle, SQL Server, dan MS Access.

Interface Microsoft Open Database Connectivity (ODBC) adalah suatu standard industri saat ini dan merupakan komponen dari Microsoft WIndows Open Services Architechture (WOSA). Interface ODBC membuat aplikasi-aplikasi dapat mengakses data dari berbagai macam database management system (DBMS). ODBC mengijinkan interoperabilitas secara maksimal terhadap berbagai macam DBMS hanya dengan melalui satu interface. Ini dapat dikatakan bahwa suatu aplikasi akan berjalan secara independen. Pengguna aplikasi dapat menambahkan suatu software komponen yang dinamakan driver, yang mana menciptakan suatu interface antara aplikasi dan suatu DBMS spesifik

Dalam tutorial ini akan disajikan secara singkat bagaimana melakukan koneksi dari PHP ke MS Access melalui ODBC.

Tutorial lengkap : Koneksi PHP Access

10 Situs Penyedia Resource PHP

Monday, April 23rd, 2007










Hello World! Program

Wednesday, April 18th, 2007

Hello World!. Dua kata sederhana, namun begitu familiar dan penting, terutama bagi kita yang berkecimpung di dunia pemrograman. It's start everything! Betul. Sebelum kita, belajar membuat aplikasi yang kompleks, terhubung ke database atau aplikasi terkoneksi ke jaringan, menggunakan bahasa pemrograman tertentu, pasti kita pertama kali akan memulainya dengan program Hello World!

Bahkan, saking pentingnya, Wikipedia secara khusus memasukkan kata ini sebagai salah satu entriesnya. Wikipedia sendiri menyebutkan bahwa, program Hello world merupakan program yang berguna sebagai sanity test (percobaan) untuk meyakinkan apakah sistem, kompiler, IDE atau run-time environment sudah berjalan (terinstall) dengan baik dan benar atau belum.

Berikut ini, program Hello World! dalam beberapa bahasa program (sekalian ngetest plugin iG:SyntaxHiliter, hehe2x ;) )

PHP, it is my most favourite programming

PHP:
  1. <?php
  2. echo 'Hello World!';
  3. ?>

C, it's my first programming

C:
  1. include «stdio.h»
  2. void main () {
  3. printf(«Hello World!»);
  4. }

Java

JAVA:
  1. public class HelloWorld {
  2. public static void main(String[] args){
  3. System.out.println(«Hello world»);
  4. }
  5. }

Visual Basic.Net

VB.NET:
  1. Imports System.Console
  2. Class HelloWorld
  3. Public Shared Sub Main()
  4. WriteLine(«Hello, world!»)
  5. End Sub
  6. End Class

Baca juga :

Bagaimana Mendapatkan Field Primary Key ?

Wednesday, August 16th, 2006

Seorang anggota milis phpug (http://groups.yahoo.com/group/phpug/) bertanya mengenai bagaimana mendapatkan nama id yang menjadi primary key dari suatu tabel MySQL.

fansul@xxx

ada nggak perintah mysql untuk mencari nama id key yang di
dalam table.
Bukan nomor urut id nya.
Soalnya kadang-2 orang bikin table untuk id kan bisa macam-2 kasih
nama.
Seperti ID, id_kary, id_sup dll
nah bagaimana saya bisa tahu kalau tabel ini nama id ini lho
terima kasih.

anghuda@xxx

bisa dong, ada caranya.

fansul@xxx

Caranya bagaimana pak

antonwhy@xxx

klo pake adodb tinggal gini aja = $fkey = $DB->MetaPrimaryKeys($table);

anghuda@xxx

besok deh, ada di rumah …

embartp@xxx

Kalo di mysql, desc, explain, show columns bisa ndak yak ?
Nah untuk php, mysql_fetch_fields ato mysql_field_type cukup ndak ?

anghuda@xxx

function getprimarykey($table){
$result = mysql_query(»SELECT * FROM $table LIMIT 1»);
while ($meta = mysql_fetch_field($result)) {
if ($meta->primary_key==1) {
$column = $meta->name;
break;
}
}
return $column;
}

solichin@xxx

Kalo seandainya primary key lebih dari 1 gimana ?

function getprimarykey($table){
$result = mysql_query(»SELECT * FROM $table LIMIT 1»);
$column = array();

while ($meta = mysql_fetch_field($result)) {
if ($meta->primary_key==1) {
$column[] = $meta->name;
}
}
return $column;
}

mungkin ada yang lebih efektif…?

embartp@xxx

Mas huda, kira2 perlu ndak ya tuh $column berupa array ?
Lagi ndak bisa nyobain codenya :(

anghuda@xxx

kira-kira begitulah, bisa pake array …
yg lebih efektif, selalu ada kemungkinan ,,,

What is PHP ?

Tuesday, August 15th, 2006

Googlism for: php

php is too easy
php is overtaking asp
php is an application
php is possible
php is developed and maintained by morons
php is for you
php is better then asp
php is to zend as modpython is to ???
php is a programming language for website applications
php is a standard
php is way better than asp
php is easy
php is working
php is installed correctly
php is cool
php is roxor
php is popular
php is your host running?
php is my first
php is a widely
php is not only capable of creating webpages
php is it
php is my friend
php is a try
php is
php is being called like you recommend
php is overtaking asp open source is hitting the big time
php is a scripting language that allows you to pull data from tables into a webpage
php is very well supported
php is loading all time
php is short for what is officially called «php
php is most commonly used as an apache module
php is cake
php is a recursive acronym for «php
php is better than asp
php is the fastest growing apache add
php is a simple
php is immensely popular on microsoft windows platform and is surprisingly more popular than microsoft's own asp web scripting language
php is for you? this support group may be for you if your child is involved in any of the following
php is running
php is to zend as modpython is to ??? brett
php is to zend as modpython is to ??? ben leslie
php is phab ring
php is running on redhat 7
php is available
php is the fastest growing server
php is a programming language used to develop web applications
php is because it's free
php is now the most popular module for the apache server and in total running on something like two million web sites
php is short for?
php is the hottest scripting language around
php is good
php is used to create dynamic web applications such as shopping carts
php is in
php is a script language and interpreter that is freely available and used primarily on linux web servers
php is the most popular server side scripting language for writing dynamic web pages
php is embedded within tags
php is the best language for web programing
php is a general purpose open
php is a full programming language
php is installed correctly thread434
php is today one of the fastest growing technologies to implement dynamic web pages
php is superior for a number of reasons
php is cool i just
php is roxor if you scroll right down to the
php is a programming language
php is successful on mission
php is your host running? to find
php is an open
php is working properly
php is commonly said to be faster and more efficient for complex programming tasks and trying out new ideas
php is a popular server
php is my first choice by far as well
php is the fastest growing scripting language on the internet
php is a server
php is one of the easiest and most powerful yet
php is available?
php is a free server side scripting language for creating dynamic interactive web sites»
php is a widely used general
php is short for «php
php is an embedded scripting language for web pages * php is free
php is an open source
php is writeable by the server

* Postingan PHP pertama nich…