ateChuLi页面(修改数据处理页面)
<?php
$code = $_POST["code"];
$name = $_POST["name"];
$sex = $_POST["sex"];
$s=1;
if($sex=="女")
{
$s=0;
}
$nation = $_POST["nation"];
$birthday = $_POST["birthday"];
$db = new MySQLi("localhost","root","","mydb");
if(mysqli_connect_error()){
die("连接失败");
}
$sql = "update Info set Name='{$name}',Sex={$s},Nation='{$nation}',Birthday='{$birthday}' where Code='{$code}'"; //修改数据语句
$r = $db->query($sql);
if($r)
{
header("location:main.php");
}
else
{
echo "修改失败!";
}
以上这篇使用PHP连接数据库_实现用户数据的增删改查的整体操作示例就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。