// 创建连接
$con = new mysqli($servername, $username, $password, $dbname);
// Check conection
if ($con->connect_error) {
die("连接失败: " . $con->conect_error);
}
$sql = "SELECT * FROM table limit 0,1000";
$result = $con->query($sql);
if ($result->num_rows > 0) {
// 输出数据
$mydata = array();
while($row = $result->fetch_assoc()) {
$mydate = '2019/04/29';
$my_post = array(
'col1' => $row["col1"],
'col2' => $row["col2"],
'col3' => '2019-04-29 10:00:00'
);
$mydata[] = $my_post;
}
} else {
echo "0 结果";
}
$con->close();
如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!
txttool.com 说一段 esp56物联 查询128 IP查询