标签:密码 tle name mys 用户名 mysqli fetch rom sel
<?php
// 假定数据库用户名:root,密码:root,数据库:test
$con=mysqli_connect("localhost","root","root","test");
if (mysqli_connect_errno($con))
{
echo "连接 MySQL 失败: " . mysqli_connect_error();
}
// 执行查询
$aa=mysqli_query($con,"SELECT a.title,a.content,b.name FROM la_blog AS a LEFT JOIN la_cate b ON a.id=b.id");//通过左链接关联查询表
$arr=[];
while ($row=mysqli_fetch_array($aa)) {
$arr[]=$row;
}
// var_dump($arr);
$bb=mysqli_query($con,"SELECT SUM(title) AS num FROM la_blog");//查看la_blog表的数据条数
$row=mysqli_fetch_array($bb);
var_dump($row[‘num‘]);
mysqli_close($con);
?>
标签:密码 tle name mys 用户名 mysqli fetch rom sel
原文地址:https://www.cnblogs.com/hualingyun/p/9117988.html