How to Display Dynamic Data in PHP table from Database
I have coded this but it is displaying nothing. I want it to display multiple data like if empid is 221 then it displays all the rows against 221 empid in the table.
<?php foreach($_POST['row'] as $row): ?> <tr> <td> <?php echo $row['id']; ?> </td> <td> <?php echo $row['empid']; ?> </td> <td> <?php echo $row['firstname']; ?> </td> <td> <?php echo $row['lastname']; ?> </td> </tr> </table> <div class="img"> <?php echo '<img src="data:image/jpeg;base64,'.base64_encode($row['image'] ).'" height="500" width="500"/>'; echo "<br>"; ?> </div> <?php endforeach; } ?>
SQL Query is this
if(isset($_POST["search"])) { $empid = $_POST['empid']; $res=mysqli_query($link,"select * from record where empid ='$empid'"); if (mysqli_num_rows($res) == 0) { echo"<script language='javascript'> alert(\"Record Not found!\"); </script> "; }