这方法不太推荐,pdo比较靠谱~不过记录下,方便改老旧代码用。

<?php
$con = mysqli_connect("127.0.0.1","vas","password","test");
if (mysqli_connect_errno($con))
{
echo mysqli_connect_error();
die();
}
$sql = "SELECT * FROM test";
$result = mysqli_query($con, $sql);
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
echo "{$row["id"]},{$row["val"]}n";
}
mysqli_free_result($result);
$sql = "INSERT INTO test (val) VALUES ('test');";
$result = mysqli_query($con, $sql);
mysqli_close($con);

如您从本文得到了有价值的信息或帮助,请考虑扫描文末的二维码对我进行赞赏和鼓励。

与《PHP mysqli常见函数请求示例》相关的博文:


发布时间 02/20/2019 07:38:50所属栏目 Program Code.所属标签 .

留言

avatar
😀
😀😁😂😅😭🤭😋😘🤔😰😱🤪💪👍👎🤝🌹👌