The following editor will bring you an overall operation example of using PHP to connect to the database to implement addition, deletion, modification and query of user data. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor and take a look.
main page(main page)
代号 | 姓名 | 性别 | 民族 | 生日 | 操作 |
{$v[0]} | {$v[1]} | {$sex} | {$attr['Name']} | {$v[4]} | 删除 修改 |
Add(Add data page)
##
添加数据
AddChuLi page(Add data processing page)
query($sql); if($result) { header("location:main.php"); //php跳转页面方式 } else { echo "添加失败!"; }
DeleteChuLi page (Delete data processing page)
query($sql); if($r) { header("location:main.php"); } else { echo "删除失败!"; }
Update page (modify data page)
修改数据
query($sql1); $att1 = $r1->fetch_row(); ?>
ateChuLi page (modify data Processing page)
query($sql); if($r) { header("location:main.php"); } else { echo "修改失败!"; }
The above is the detailed content of Example of adding, deleting, modifying and checking user data by connecting to the database in PHP. For more information, please follow other related articles on the PHP Chinese website!