2021.4.14

今天在phpstorm上成功地连接了数据库phpmyadmin,并从中查询读取出了表里的内容

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>array</title>
</head>
<body>
<?php
$conn=mysqli_connect("localhost","root","123456","mydb") or die("数据库连接失败");
mysqli_query($conn,'set names utf8');
$sql="select * from student";
$result=mysqli_query($conn,$sql)or die("数据查询失败");
while($row=mysqli_fetch_array($result))
{
print_r($row);
echo "<br/>";
}
?>
</body>
</html>

 遇到问题:在最开始我的xampp并不能打开phpmyadmin,拒绝访问,最后在同学的帮助下,用wampserver成功运行

posted @ 2021-04-14 00:07  墨夕相拥★  阅读(39)  评论(0编辑  收藏  举报