您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

如何从数据库回显表行(PHP)

如何从数据库回显表行(PHP)

$sql = "SELECT * FROM MY_TABLE";
$result = MysqLi_query($conn, $sql); // First parameter is just return of "MysqLi_connect()" function
echo "<br>";
echo "<table border='1'>";
while ($row = MysqLi_fetch_assoc($result)) { // Important line !!! Check summary get row on array ..
    echo "<tr>";
    foreach ($row as $field => $value) { // I you want you can right this line like this: foreach($row as $value) {
        echo "<td>" . $value . "</td>"; // I just did not use "htmlspecialchars()" function. 
    }
    echo "</tr>";
}
echo "</table>";
php 2022/1/1 18:14:09 有488人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶