i have a simple php page, where i use the following code to display data and check if the query returned values or if not just display an alert box,
<?php
$eid=$_GET['empid'];
$month=$_GET['searchdata'];
$year=date("Y");
$rett=mysqli_query($con,"select * from salary where empid='$eid' and month='$month' and year='$year' ");
if($rett){
while ($row=mysqli_fetch_array($rett)) {
?>
<form method="post">
<table border="1" class="table table-bordered mg-b-0">
<tr>
<th>Full Name</th>
<td><input type="text" name="name" value="<?php echo $row['name'];?>"></td>
</tr>
<tr align="center">
<td colspan="2"><button type="submit" name="update" class="btn btn-primary btn-sm">Update</button></td>
</tr>
</tr>
</table>
</form>
<?php } } else{ ?>
<div class="alert alert-info" role="alert">
No Details Available for this Month
</div>
<?php }?>as you can see, if query returns then just the form otherwise show bootstrap alert saying no data, if data is there, the form is displaying succefully, but the issue is if query is empty bootstrap alert is not getting shown, instead i get blank page, can anyone please tell me what could be wrong in here,thanks in advance
Aucun commentaire:
Enregistrer un commentaire