Postingan lainnya
menampilkan data view dari database
permisi kak pengen nanya nih, gimana yah caranya nampilkan data perulangan dari database sudah sya coba berbagai macam query cuman masih gagal nih kak. mohon bantuannya kak.
nah dari view data hasil ini harusnya data yang ada di samping itu tampilnya di bawah ka sesuai urutan id_hasil. Ini data yang dari database :
dan berikut querynya :
<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr><center>
<th>NO</th>
<th>ID USER</th>
<th>NO ID</th>
<th>NAMA STAF</th>
<th>TANGGAL</th>
<?php
$soal = mysql_query("SELECT * from tb_soal"); //menampilkan jumlah soal
$n = 1;
while($data = mysql_fetch_array($soal)){
echo "<th><center>Soal $n</center></th>";
$n++;
}
?>
</center></tr>
</thead>
<tbody>
<?php
$id_staf = $_GET['idu'];
$id_user = $_POST['id_user'];
if ($id_staf=="") {
$no = 1;
$query_resp = mysql_query("select * from tb_hasil_kue,tb_staf where tb_hasil_kue.id_staf = tb_staf.id_staf group by tb_hasil_kue.id_staf");
while ($data = mysql_fetch_array($query_resp)) {
$user = mysql_query("select * from tb_hasil_kue,tb_login where tb_hasil_kue.id_user=tb_login.id_user");
$data_user = mysql_fetch_array($user);
?>
<tr class="gradeU">
<td><?php echo $no.'.'; ?></td>
<td><?php echo $data['id_user'];?></td>
<td><?php echo $data_user['no_id']; ?></td>
<td><?php echo $data['nama']; ?></td>
<td><?php echo $data['tgl']; ?></td>
<?php
$jawaban = mysql_query("select jawaban from tb_hasil_kue where id_staf='$data[id_staf]'");
while ($data_jwb = mysql_fetch_array($jawaban)) {
$nilai = $data_jwb['jawaban'];
echo "<td> <center>$nilai</center> </td>";
}
echo "</tr>";
$no++;
}
}
?>
</tbody>
</table>
</div>
0
5 Jawaban:
coba perhatika tutup udah lengkap belum :D
0
msh ada yang kurang ko tutup nya dicek lagi jangan malas
0
coba bagian sini diubah
$jawaban = mysql_query("select jawaban from tb_hasil_kue where id_staf='$data[id_staf]'");
while ($data_jwb = mysql_fetch_array($jawaban)) {
$nilai = $data_jwb['jawaban'];
echo "<td> <center>$nilai</center> </td>";
}
echo "</tr>";
$no++;
}
jadi
$jawaban = mysql_query("select jawaban from tb_hasil_kue where id_staf='$data[id_staf]'");
while ($data_jwb = mysql_fetch_array($jawaban)) {
$nilai = $data_jwb['jawaban'];
echo "<td> <center>$nilai</center> </td>";
} $no++;
echo "</tr>";
}
0
code ini
<?php
$jawaban = mysql_query("select jawaban from tb_hasil_kue where id_staf='$data[id_staf]'");
while ($data_jwb = mysql_fetch_array($jawaban)) {
$nilai = $data_jwb['jawaban'];
echo "<td> <center>$nilai</center> </td>";
}
echo "</tr>";
$no++;
}
}
?>
diganti dengan code ini
<?php
$jawaban = mysql_query("select jawaban from tb_hasil_kue where id_staf='$data[id_staf]'");
$data_jwb = mysql_fetch_array($jawaban);
$nilai = $data_jwb['jawaban'];
echo "<td> <center>$nilai</center> </td>";
echo "</tr>";
$no++;
}
}
?>
0