PHP最简单的操作数据库
<?php
//1,连接数据库
$conn=mysql_connect('127.0.0.1','root','root');
if(!$conn){
die("连接失败".mysql_error);
}
//2,选择数据库
mysql_select_db("test");
//3,发送操作语句
$sql="select*fromuser";
//4,接收结果
$res=mysql_query($sql,$conn);
//5,遍历结果
while($row=mysql_fetch_row($res)){
echo"<br/>$row[0]--$row[1]--$row[2]";
}
//6,关闭
mysql_free_result($res);
mysql_close($conn);
?>
相关推荐
sunnyxuebuhui 2020-09-07
xkorey 2020-09-14
云中舞步 2020-11-12
张荣珍 2020-11-12
amienshxq 2020-11-14
ASoc 2020-11-14
yungpheng 2020-10-19
loveyouluobin 2020-09-29