terimakasih telah menjawab pertanyaan saya dulu tentang memunculkan nama instruktur seperti ini
<?php require_once('koneksi/koneksi.php'); include('cek_login.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>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include ('header.php') ?>
<div id="isi">
<div align="center"></div>
<center>
<h1>DATA JENIS PELATIHAN</h1> </center>
<a href="input_pelatihan.php">+Tambah Data</a>
<table border="1" cellpadding="3" cellspacing="0"><th>No</th><th>Kode</th><th>Nama</th><th>Nama Inggris</th><th>Jumlah Jam</th><th>Instruktur 1</th><th>Instruktur 2</th><th>Instruktur 3</th><th>Instruktur 4</th><th>Aksi</th>
<?php
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
$warna1= "FFFFFF";
$warna2= "#FFF8DC";
$warna= $warna1;
//jumlah data yg akan ditampilkan
$dataperpage=5;
if(isset($_GET['page']))
{
$nopage=$_GET['page'];
}
else $nopage=1;
// perhitungan offset
$offset=($nopage-1)*$dataperpage;
//query SQL untuk menampilkan data perhalaman sesuai offset
$query = "SELECT * FROM tpelatihan order by kd_plthn LIMIT $offset, $dataperpage";
$result= mysql_query($query) or die ('Error');
// membaca nomer halaman
// membuat nomer urut awal disetiap halaman berdasarkan formula diatas
$i=$nopage + ($nopage - 1) * ($dataperpage-1);
// menampilkan data
while($data=mysql_fetch_array($result))
{
//background berwarna
if($warna==$warna1){
$warna=$warna2;}
else {$warna=$warna1;}
$nomor++;
if($data['nip1']){
$nip1 = mysql_fetch_array(mysql_query("select * from tinstruktur where nip='".$data['nip1']."'"));
}
if($data['nip2']){
$nip2 = mysql_fetch_array(mysql_query("select * from tinstruktur where nip='".$data['nip2']."'"));
}
if($data['nip3']){
$nip3 = mysql_fetch_array(mysql_query("select * from tinstruktur where nip='".$data['nip3']."'"));
}
if($data['nip4']){
$nip4 = mysql_fetch_array(mysql_query("select * from tinstruktur where nip='".$data['nip4']."'"));
}
?>
<tr bgcolor=<?Php echo "$warna" ?> class='data'>
<td><?php echo "$i" ?></td><?php $i++; ?>
<td><?php echo "$data[kd_plthn]" ?></td>
<td><?php echo "$data[nm_plthn]" ?></td>
<td><?php echo "$data[nm_ing]" ?></td>
<td><?php echo "$data[jml_jam]" ?></td>
<td><?php echo !isset($nip1) ? '' : $nip1['nm_inst'];?></td>
<td><?php echo !isset($nip2) ? '' : $nip2['nm_inst'];?></td>
<td><?php echo !isset($nip3) ? '' : $nip3['nm_inst'];?></td>
<td><?php echo !isset($nip4) ? '' : $nip4['nm_inst'];?></td>
<td><table><tr><td><a href='edit_pelatihan.php?kd_plthn=<?php echo "$data[kd_plthn]"; ?>'>Ubah</a></td><td>|</td><td><a href='delete_pelatihan.php?kd_plthn=<?php echo "$data[kd_plthn]"; ?>' onclick="return confirm('Yakin akan hapus data <?php echo "$data[nm_plthn]"?>?')"> Hapus</a></td></tr></table></td>
</tr>
<?php
}
?>
</table>
<p><center>
<?php
// mencari jumlah semua data dalam tabel siswa
$query = "SELECT COUNT(*) AS jumdata FROM tpelatihan";
$hasil = mysql_query($query);
$data = mysql_fetch_array($hasil);
$jumdata=$data['jumdata'];
// menentukan jumlah halaman yang muncul berdasarkan jumlah semua data
$jumpage = ceil($jumdata/$dataperpage);
// menampilkan link previous
if ($nopage > 1) echo "<a href='".$_SERVER['PHP_SELF']."?page=".($nopage-1)."'><< sebelumnya</a>";
// memunculkan nomor halaman dan linknya
for($page = 1; $page <= $jumpage; $page++)
{
if ((($page >= $nopage - 3) && ($page <= $nopage + 3)) || ($page == 1) || ($page == $jumpage))
{
if (($showpage == 1) && ($page != 2)) echo "...";
if (($showpage != ($jumpage - 1)) && ($page == $jumpage)) echo "...";
if ($page == $nopage) echo " <b>".$page."</b> ";
else echo " <a href='".$_SERVER['PHP_SELF']."?page=".$page."'>".$page."</a> ";
$showpage = $page;
}
}
// menampilkan link next
if ($nopage < $jumpage) echo "<a href='".$_SERVER['PHP_SELF']."?page=".($nopage+1)."'>Selanjutnya>></a>";
?>
</p>
<p> </p>
</div>
<?php include ('footer.php') ?>
</body>
</html>
yang saya tanyakan lagi, bagaimana cara membuat halaman edit jenis pelatihan dengan nama instruktur yang telah dimasukkan akan muncul sesuai dengan data yang telah ada, saya telah membuat halaman edit seperti ini, tetapi nama instrukturnya tidak dapat muncul sesuai dengan yang telah dimasukkan sebelumnya,mohon bantuannya lagi mas, terimakasih
<?php require_once('koneksi/koneksi.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>Untitled Document</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php include ('header.php') ?>
<div id="isi">
<div align="center"></div>
<center>
<h1>UBAH DATA PELATIHAN</h1>
<?php
$kd_plthn=$_GET['kd_plthn'];
$query=mysql_query("SELECT * FROM tpelatihan where kd_plthn='$kd_plthn'") or die(mysql_error());
$data=mysql_fetch_array($query);
?>
<form name="edit" method="POST" action="aksi_edit_pelatihan.php">
<input type="hidden" name="kd_plthn" value="<?php echo $data['kd_plthn']; ?>" />
<table border="0" cellpadding="3" cellspacing="0">
<tr>
<td>Kode Pelatihan</td>
<td>:</td>
<td>
<input type="text" name="kd_plthn" maxlength="4" size="4" value="<?php echo $data['kd_plthn']; ?>" />
</td>
</tr>
<tr>
<td>Nama Pelatihan</td>
<td>:</td>
<td>
<input type="text" name="nm_plthn" maxlength="30" size="30" value="<?php echo $data['nm_plthn']; ?>" />
</td>
</tr>
<tr>
<td>Nama Inggris</td>
<td>:</td>
<td><input type="text" name="nm_ing" maxlength="30" size="35" value="<?php echo $data['nm_ing']; ?>" /></td>
</tr>
<tr>
<td>Jumlah Jam</td>
<td>:</td>
<td>
<input name="jml_jam" type="radio" value="120" <?php if ($data['jml_jam']=='120') echo "checked" ?> />120
<input name="jml_jam" type="radio" value="240" <?php if ($data['jml_jam']=='240') echo "checked" ?> />240
</td>
</tr>
<tr>
<td>Instruktur 1</td>
<td>:</td>
<td>
<select name="nip1" >
<?php
$sql="SELECT * FROM tinstruktur";
$hasil=mysql_query($sql);
while($baris=mysql_fetch_object($hasil))
{
echo'<option value="'.$baris->nm_inst.'"'.($baris->nm_inst==$data['nip1']?'selected="selected"' : '').'>'.$baris->nm_inst.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Instruktur 2</td>
<td>:</td>
<td>
<select name="nip2" >
<?php
$sql="SELECT * FROM tinstruktur";
$hasil=mysql_query($sql);
while($baris=mysql_fetch_object($hasil))
{
echo'<option value="'.$baris->nm_inst.'"'.($baris->nm_inst==$data['nip2']?'selected="selected"' : '').'>'.$baris->nm_inst.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Instruktur 3</td>
<td>:</td>
<td>
<select name="nip3" >
<option value="-"></option>
<?php
$sql="SELECT * FROM tinstruktur";
$hasil=mysql_query($sql);
while($baris=mysql_fetch_object($hasil))
{
echo'<option value="'.$baris->nm_inst.'"'.($baris->nm_inst==$data['nip3']?'selected="selected"' : '').'>'.$baris->nm_inst.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td>Instruktur 4</td>
<td>:</td>
<td>
<select name="nip4" >
<option value="-"></option>
<?php
$sql="SELECT * FROM tinstruktur";
$hasil=mysql_query($sql);
while($baris=mysql_fetch_object($hasil))
{
echo'<option value="'.$baris->nm_inst.'"'.($baris->nm_inst==$data['nip4']?'selected="selected"' : '').'>'.$baris->nm_inst.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<input type="submit" value="Simpan" name="submit"/> <input type="reset" value="Batal" name="reset"/> <input type="button" value="Kembali" onClick="history.go(-1);">
</td>
</tr>
</table>
</form>
</center></div>
<?php include ('footer.php') ?>
</body>
</html>
oya mas, relasi anatar tabel pelatihan dan instruktur nya adalah satu kebanyak, jadi tiap jenis pelatihan minimal 2 instruktur atau maksimal 4,jadi tiap instruktur hanya mengajar satu pelatihan saja.