php关于数据库的增删改查

第一个页面:




数据库查询

数据库插入

数据库修改

数据库删除

 

数据库查询页面:

";
echo "idnamesexaddress";
$result=mysqli_query($con,"select *from stu");
while($row=mysqli_fetch_array($result)){
echo ''.$row['id']."".$row["name"]."".$row["sex"]."".$row["address"]."";

}
mysqli_free_result($result);
mysqli_close($con);
?>

数据库插入页面:

";

$sql=mysqli_query($con,"insert into stu(id,name,sex,address)values('1004','小花','女','上海')");
if($sql){
	echo "插入成功";
}

mysqli_close($con);
?>

数据库修改页面:


";
echo "
";} $result=mysqli_query($con,"update stu set name='小可' where address='上海'"); if($result){ echo "修改成功"; } ?>

数据库删除页面:

";
	
}
$result=mysqli_query($con,"delete from stu where name='小花'");
if($result){
	echo "删除成功";
}






mysqli_close($con);
?>

你可能感兴趣的:(php,php,数据库,mysql)