mysql-PHP MySQL Update修改数据库失败,无警告报错
程序员文章站
2022-04-24 20:41:53
...
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''; }
?>