Skrip tampildata.php
<?php
$koneksi=mysql_connect(“localhost”,”root”,”password”) or die (“Gagal konek
server”.mysql_error());
If($koneksi) {
mysql_select_db(”buku”,$koneksi)
or die (”Database gagal dibuka”.mysql_error());
’Menjalankan
Query
$sql=mysql_query(”SELECT * FROM anggota”, $koneksi)
or die (“Query Gagal”.mysql_error());
while ($data=mysql_fetch_array($sql)){ echo “ID : $data[id_anggota]<br>”; echo “Nama : $data[nm_anggota]<br>”;
echo”Alamat
: $data[alamat]<br>”;
echo”Kelamin : “;
echo ($data[‘kelamin’]==”P”)?”Pria”:”Wanita”<br><hr>”;
}
}
?>
No comments:
Post a Comment