update查询运行,但sql数据库中的字段没有更新

c9x0cxw0  于 2021-06-17  发布在  Mysql
关注(0)|答案(1)|浏览(449)

我有一个更新页面,其中有电子邮件和密码的更新形式,我试着控制台日志,看看电子邮件和地址是否在后的方式传输,并将详细信息传输到这个页面,但仍然是数据没有持久化,能有人请告诉我为什么谢谢!

<?php session_start(); ?>

    <?php

        //extract form values and assign to regular PHP variables
        $uemail=$_POST['email'];    
        $passW=$_POST['pass'];
        $upassword= md5($_POST['passW']);

    if(!isset($_SESSION['usermail'])) {
        header('Location: ../homepage.php');
    }

else{
include "connection.php";

$session=$_SESSION["useremail"];    

    $sql = "UPDATE users SET uemail = '$uemail', upassword = '$upassword' WHERE uemail = '$session'";

$_SESSION["useremail"]=$uemail; //setting new email in session

        header("Location:../homepage.php");
    }
?>
oyt4ldly

oyt4ldly1#

试着把这些变量联系起来。

<?php session_start(); ?>

    <?php

        //extract form values and assign to regular PHP variables
        $uemail=$_POST['email'];    
        $passW=$_POST['pass'];
        $upassword= md5($_POST['passW']);

    if(!isset($_SESSION['usermail'])) {
        header('Location: ../homepage.php');
    }

else{
include "connection.php";

$session=$_SESSION["useremail"];    

    $sql = "UPDATE users SET uemail = '".$uemail."', upassword = '".$upassword."' WHERE uemail = '".$session."'";

$_SESSION["useremail"]=$uemail; //setting new email in session

        header("Location:../homepage.php");
    }
?>

如果你的变量是正确的,一定要检查。。总是看你的密码。。

相关问题