insert插入没反应求大佬解答

<?php
$db=@mysqli_connect('localhost','root','','adatabase')
or die("无法连接到服务器");

$sq="INSERT INTO User (Id, Name, Age, Gender, Info)
values(4,'fangfang',18,'female','She is a 18 years lady')";
//插入数据
$result = mysqli_query($db,$sq);
if($result){
echo "插入数据成功!
";
}else{
echo "插入数据失败!
";
}
//更新数据库
$sq = "update User set Name='张芳' where Name='fangfang'";
$result = mysqli_query($db,$sq);
if($result){
echo "更新数据成功
";
}else{
echo "更新数据失败!
";
}

$sq = "select * from user";
$result = mysqli_query($db,$sq);

mysqli_close($db);
?>
`
运行之后显示
插入数据失败
更新数据成功
菜鸟刚学没几天求大佬解答
insert插入没反应
使用XAMPP的mysql

查看全部
qq_42689724
Blacklsh
2019/03/28 22:08
  • php
  • 点赞
  • 收藏
  • 回答
    私信

1个回复