Tampil data yang berelasi

dwi nurwulan · Jun 17, 2014
sore gan, ane mohon bantuan
ane mau nampilin data yang berelasi ko gabisa yah.
ane coba nampilin data jenis_barang bisa. tp pas semua disatuin jd gabisa gini
apa yg salah yah gan?
<?php
session_start(); 
include_once "login_session.php";
?>
<!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>Daftar Barang</title>
</head>
<body>
<table width="600" border="0" cellspacing="1" cellpadding="2">
  <tr>
    <td width="27" bgcolor="#CCCCCC"><strong>No</strong></td>
    <td width="57" bgcolor="#CCCCCC"><strong>Kode Barang</strong></td>
    <td width="198" bgcolor="#CCCCCC"><strong>Jenis Barang</strong></td>
    <td width="198" bgcolor="#CCCCCC"><strong>Type Barang</strong></td>
    <td width="198" bgcolor="#CCCCCC"><strong>Merk Barang</strong></td>
    <td width="198" bgcolor="#CCCCCC"><strong>Keterangan Barang</strong></td>
    <td width="198" bgcolor="#CCCCCC"><strong>Tanggal Masuk Barang</strong></td>
    <td width="198" bgcolor="#CCCCCC"><strong>Satuan Barang</strong></td>
    <td width="198" bgcolor="#CCCCCC"><strong>Total Harga Barang</strong></td>
    <td width="198" bgcolor="#CCCCCC"><strong>Satuan Barang</strong></td>
    <td width="117" align="center" bgcolor="#CCCCCC"><strong>Action</strong></td>
  </tr>
  <?php
		
include_once "../librari/inc.koneksidb.php";
include_once "../librari/inc.librari.php";
if($_GET) {
	$kdBarang 	= $_GET['kdBarang'];
	$sql		= "SELECT barang .*, jenis.nm_jenis, type.nm_type, merk.nm_merk, rekanan.nm_rekanan FROM barang, jenis, type, merk, rekanan WHERE barang.kd_jenis=jenis.kd_jenis, 						 				barang.kd_type=type.kd_type, barang.kd_merk=merk.kd_merk, barang.kd_rekanan=rekanan.kd_rekanan AND barang.kd_barang='$kdBarang'";
	$query = mysql_query($sql, $koneksiDbs) or die ("Query barang salah : ".mysql_error());
	$nomor  = 0; 
	while ($data = mysql_fetch_array($query)) {
	$nomor++;
?> 
  <tr>
    <td> <?php echo $nomor; ?> </td>
    <td> <?php echo $data['kd_barang']; ?> </td>
    <td> <?php echo $data['nm_jenis']; ?> </td>
    <td> <?php echo $data['nm_type']; ?> </td>
    <td> <?php echo $data['nm_jenis']; ?> </td>
    <td> <?php echo $data['ket_barang']; ?> </td>
    <td> <?php echo $data['tgl_masuk']; ?> </td>
    <td> <?php echo $data['satuan']; ?> </td>
    <td> <?php echo $data['total']; ?> </td>
    <td> <?php echo $data['nm_rekanan']; ?> </td>
    <td align="center">
	<a href="barangUbah.php?Kode=<?php echo $data['kd_barang']; ?>" target="_self">Edit</a> | 
	<a href="barangHapus.php?Kode=<?php echo $data['kd_barang']; ?>" target="_self">Delete</a></td>
  </tr>
<?php } ?>
</table>
</body>
</html>
Silahkan login untuk menjawab!