当前位置:Gxlcms > mysql > mysql-PHPMySQLUpdate修改数据库失败,无警告报错

mysql-PHPMySQLUpdate修改数据库失败,无警告报错

时间:2021-07-01 10:21:17 帮助过:2人阅读

mysqlphpupdate

if(isset($_POST['submit'])&& $_POST['submit'])    {        $UID=$_GET['ID'];           $name=$_POST['uname'];        $phone=$_POST['phone'];        $email=$_POST['email'];        $servername="localhost";        $username = "root";        $password = "";        $dbname = "records";        // 创建连接        $conn = new mysqli($servername, $username, $password, $dbname);        // 检测连接        if ($conn->connect_error) {        die("Connection failed: " . $conn->connect_error);}        $sql="UPDATE user SET u_name=$name,u_phone=$phone,u_email=$email WHERE id='$UID'";        if(mysqli_query($conn,$sql)){            echo "修改成功!";}        else{            echo"修改失败!";}        mysqli_close($conn);        echo'';    }

?>

人气教程排行