操作环境:wampserver+phpstorm
进入phpMyAdmin(账号初始值:root,密码为空)
在php操作数据库的流程
<?php $conn = mysqli_connect('localhost','root',''); if($conn){ //代表连接成功 //先获取 mysqli_select_db($conn,'myapp'); //连接到myapp数据库 $result=mysqli_query($conn,"SELECT * FROM user"); //结果集 $result_num=mysqli_num_rows($result); //获取查询结果的条数 for($i=0;$i<$result_num;$i++){ $result_arr=mysqli_fetch_assoc($result); print_r($result_arr); echo "<br>"; } }else{ echo "连接失败"; } ?>