📜  使用 php 代码示例从数据库更新一行

📅  最后修改于: 2022-03-11 14:53:43.950000             🧑  作者: Mango

代码示例1
// ... 

if (isset($_POST['update'])) {
    $id = $_POST['id'];
    $name = $_POST['name'];
    $address = $_POST['address'];

    mysqli_query($db, "UPDATE info SET name='$name', address='$address' WHERE id=$id");
    $_SESSION['message'] = "Address updated!"; 
    header('location: index.php');
}