萌萌达
2015-06-02 17:00
采纳率: 40%
浏览 5.3k

PHP MySQL Update修改数据库失败,无警告报错

<?php

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'<meta http-equiv="refresh" content="2;url=empManage.php">';
    }

?>

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

5条回答 默认 最新

相关推荐 更多相似问题