Postingan lainnya
Kelas Premium!
Belajar bikin website dari nol sekarang
Gunakan kupon "lebihcepat" untuk diskon 25%!
Menampilkan deskripsi berdasarkan id
gan agan, ane mau nanya nih ane mau nampilin deskripsi berdasarkan id tapi kenapa yang muncul selalu deskripsi pertama mulu ya? nampilinya pake modalview nih gan kode nya:
<div class="card">
<div class="card-header">
<h2>Services List
</h2>
</div>
<div class="table-responsive">
<table id="data-table-basic" class="table table-striped">
<thead>
<tr>
<th>NO</th>
<th>ID</th>
<th>SERVICE</th>
<th>STATUS</th>
<th>DESKRIPSI</th>
<th>ACTION</th>
</tr>
</thead>
<tbody>
<?php
$queryu = "SELECT * FROM service ORDER BY no ASC";
$exe = mysql_query($queryu);
$cek = mysql_num_rows($exe);
$no = 1;
while($row = mysql_fetch_assoc($exe)){
$id = $row['no'];
$service = $row['service'];
$deskk = $row['description'];
$status = $row['status'];
?>
<tr>
<td><?php echo $no; ?></td>
<td><?php echo $id; ?></td>
<td><?php echo $service; ?></td>
<td><?php echo $status; ?></td>
<td><a class="btn btn-sm btn-block btn-info waves-effect waves-light" data-toggle="modal" data-target="#deskripsii"> Deskripsi</a></td>
<div id="deskripsii" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Deskripsi Service</h4>
</div>
<div class="modal-body">
<div class="form-group">
<p> <?php echo $deskk; ?> </p>
</div>
</div>
<td><a class="btn btn-sm btn-block btn-success waves-effect waves-light" href="?adminmenu=services&id=<?php echo $id; ?>"> Edit</a></td>
</tr>
<?
$no++;
} ?>
makasih gan sebelumnya :)
0
2 Jawaban:
Tambahkan where clause di querynya <pre> $queryu = "SELECT * FROM service where id = 'id yg dicari'";</pre>
0
sedikit rekomendesi <a href=' https://www.w3schools.com/php/php_mysql_select.asp '>Web</a>
0