Itrate mysql table rows in php

<table id="datatable" class="table table-striped table-bordered"> <thead> <tr> <th>Client Name</th> <th>Card No.</th> <th>Status</th> </tr> </thead> <tbody> <?php $result=mysql_query("select * from tbl_clients"); while($row=mysql_fetch_array($result)) { $status = $row['status']==1 ? "Active" : "Inactive"; ?> <tr> <td><?php echo $row['name']; ?></td> <td><?php echo $row['card_no']; ?></td> <td><?php echo $status; ?></td> </tr> <?php } ?> </tbody> </table>

Share This: