mysqli_query错误
<?php$username=$_POST['username'];$password1=$_POST['password1'];$password2=$_POST['p...
<?php
$username = $_POST['username'];
$password1 = $_POST['password1'];
$password2 = $_POST['password2'];
$name = $_POST['name'];
$gender = $_POST['gender'];
$id_card = $_POST['id_card'];
$phone_num = $_POST['phone_num'];
$email = $_POST['email'];
$hospital = $_POST['hospital'];
$department = $_POST['department'];
$depart_phone = $_POST['depart_phone'];
$ident_code = $_POST['ident_code'];
$connect = mysqli_connect('127.0.0.1', 'root', 'dialectical', 'hereid')or die ('Error connecting to MySQL server.');
$query = "INSERT INTO doctors (username, password, name, gender, id_card, phone_num, email, hospital, department, depart_phone) VALUES ('$username', '$password1', '$name', '$gender', '$id_card', '$phone_num', '$email', '$hospital', '$department, '$depart_phone')";
$result = mysqli_query($connect, $query) or die ('Error querying database.');
mysqli_close($connect);
?>
显示:Error querying database.
我咋找不出错误呢。。。 展开
$username = $_POST['username'];
$password1 = $_POST['password1'];
$password2 = $_POST['password2'];
$name = $_POST['name'];
$gender = $_POST['gender'];
$id_card = $_POST['id_card'];
$phone_num = $_POST['phone_num'];
$email = $_POST['email'];
$hospital = $_POST['hospital'];
$department = $_POST['department'];
$depart_phone = $_POST['depart_phone'];
$ident_code = $_POST['ident_code'];
$connect = mysqli_connect('127.0.0.1', 'root', 'dialectical', 'hereid')or die ('Error connecting to MySQL server.');
$query = "INSERT INTO doctors (username, password, name, gender, id_card, phone_num, email, hospital, department, depart_phone) VALUES ('$username', '$password1', '$name', '$gender', '$id_card', '$phone_num', '$email', '$hospital', '$department, '$depart_phone')";
$result = mysqli_query($connect, $query) or die ('Error querying database.');
mysqli_close($connect);
?>
显示:Error querying database.
我咋找不出错误呢。。。 展开
- 你的回答被采纳后将获得:
- 系统奖励15(财富值+成长值)+难题奖励30(财富值+成长值)
1个回答
展开全部
$result = mysqli_query($connect, $query) or die ('Error querying database.');这句话后面加上. mysqli_error($connect ))即改为:
$result = mysqli_query($connect, $query) or die ('Error querying database.'. mysqli_error($connect )));
查看一下返回什么错误描述,然后根据错误描述进行修改,当然也可以查看mysql的错误日志啦
ps:光从代码上没看出错误,有可能数据库里的字段名你写错了
$result = mysqli_query($connect, $query) or die ('Error querying database.'. mysqli_error($connect )));
查看一下返回什么错误描述,然后根据错误描述进行修改,当然也可以查看mysql的错误日志啦
ps:光从代码上没看出错误,有可能数据库里的字段名你写错了
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询