PHP连接MySQL进行增、删、改、查操作

高洛峰
Release: 2023-03-05 21:56:02
Original
1357 people have browsed it

本篇文章主要介绍了PHP连接MySQL进行增、删、改、查操作的方法,具有很好的参考价值,下面跟着小编一起来看下吧

话不多说,请看代码:


query($sql);
4.判断返回是否执行成功
if($reslut)
{
while($attr = $reslut->fetch_row())
{
echo "";
}
}
?>
代号 姓名 性别 民族 生日
{$attr[0]} {$attr[1]} {$attr[2]} {$attr[3]} {$attr[4]}
Copy after login


fetch_all() 返回全部数组

fetch_row() 返回索引数组

fetch_assoc() 返回关联数组

fetch_object() 返回对象

fetch_array() 返回的数组既有索引的,又有关联的

数据库的删除,增加,修改操作


query($sql);
if($r)
{
echo "执行成功";
}
else
{
echo "执行失败";
}
?>
Copy after login

更多PHP连接MySQL进行增、删、改、查操作相关文章请关注PHP中文网!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!