数据修改

$id = $_COOKIE['admin'];

$qwe = new mysqli('localhost', 'root', 'root', 'qwer');
if ($qwe->connect_error) {
  echo $qwe->connect_error;
  exit();
}
$sqe = "select * from wer where id = $id";
$conn = $qwe->query($sqe);
// 转换成一维数组
$info = $conn->fetch_assoc();

if ($_POST) {
  $name = trim($_POST['name']);
  $pasd = md5($_POST['pasd']);

  $sql = "update admin set name='$name' , pasd='$pasd' where id = $id";
  $res = $qwe->query($sql);
}
  <?php
    if ($res) {
      setcookie('admin', '', time() - 3600);
    
    ?>
      window.open('../login.php', '_top');


      <?php
    } else {
      ?>layer.msg('修改失败');
    <?php
    }

    ?>
原文地址:https://www.cnblogs.com/mark645524126/p/13590686.html