php - How to display PDO rows results vertically? -
code!
<?php $stmt = $db_con->prepare('select userid, fullname, birthdate, deathdate name'); $stmt->execute(); if($stmt->rowcount() > 0) { while($row=$stmt->fetch(pdo::fetch_assoc)) { extract($row); echo "<td align='center'><div class='listxtnb' style='width:30px;'>" .$row['userid']. "</div></td>"; echo "<td align='center'><div class='listxtnb' style='width:135px;'>" .$row['fullname']. "</div></td>"; echo "<td align='center'><div class='listxtnb' style='width:95px;'>" .$row['birthdate']. "</div></td>"; echo "<td align='center'><div class='listxtnb' style='width:95px;'>" .$row['deathdate']. "</div></td>"; echo "<td align='center'><div class='listxtnb' style='width:45px;'><a href='editform.php?edit_id=".$row['userid']."'>edit</a></div></td>"; echo "<td align='center'><div class='listxtnb' style='width:45px;'><a href='?delete_id=".$row['userid']."' onclick='return confirm('sure delete ?')>delete</a></div></td>"; echo "</tr></table>"; ?>
you have adjust code following:
<?php $stmt = $db_con->prepare('select userid, fullname, birthdate, deathdate name'); $stmt->execute(); if($stmt->rowcount() > 0) { echo "<table>"; while($row=$stmt->fetch(pdo::fetch_assoc)) { extract($row); echo "<tr>"; echo "<td align='center'><div class='listxtnb' style='width:30px;'>" .$row['userid']. "</div></td>"; echo "<td align='center'><div class='listxtnb' style='width:135px;'>" .$row['fullname']. "</div></td>"; echo "<td align='center'><div class='listxtnb' style='width:95px;'>" .$row['birthdate']. "</div></td>"; echo "<td align='center'><div class='listxtnb' style='width:95px;'>" .$row['deathdate']. "</div></td>"; echo "<td align='center'><div class='listxtnb' style='width:45px;'><a href='editform.php?edit_id=".$row['userid']."'>edit</a></div></td>"; echo "<td align='center'><div class='listxtnb' style='width:45px;'><a href='?delete_id=".$row['userid']."' onclick='return confirm('sure delete ?')>delete</a></div></td>"; echo "</tr>"; } echo "</table>"; } ?>
Comments
Post a Comment