Pencarian

Ini adalah source PHP untuk pencarian dalam database...

pencarian.php

<?php $link = mysql_connect(“localhost”, “root”, “db”);
mysql_select_db(“db”, $link);
$query = “SELECT * FROM tb_anggota where (nama like ‘%$kata_kunci%’) or (alamat=’$kata_kunci%’) ORDER BY id DESC”;
$result = mysql_query($query);
if (mysql_num_rows($result) > 0) {
echo “Ditemukan kata kunci <b>$kata_kunci</b> pada database:<ul>”;
while ($row = mysql_fetch_array($result)) {
echo “Nama   : $row[nama] | Alamat : $row[alamat]”;}
}else{
echo “Kata kunci <b>$kata_kunci</b> tidak ditemukan….!!!”; }?>

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: