简体   繁体   English

我的 sql 查询有错误吗?

[英]Is there any error in my sql query?

I want to update my user_info table but it's not working.我想更新我的user_info表,但它不起作用。 In my user_info I have already taken some values from one activity and from another activity I want to take some more values but it's not working.在我的user_info我已经从一个活动和另一个活动中获取了一些值,我想获取更多的值,但它不起作用。 I'm pretty sure that there is no error in my Java code.. is there any error in my query?我很确定我的 Java 代码中没有错误..我的查询中有任何错误吗?

$db_name = "db";
$mysql_user = "root";
$mysql_pass = "";
$server_name = "localhost";

$con = mysqli_connect($server_name, $mysql_user, $mysql_pass, $db_name);

$name = $_POST["user"];
$user_email = $_POST["user_email"];
$Gender = $_POST["Gender"];
$contact = $_POST["contact"];
$address = $_POST["address"];

$sql_query = "UPDATE user_info SET name='$name', Gender='$Gender', contact='$contact', address='$address' WHERE user_email='$user_email'";
mysqli_query($con,$sql_query)

mysqli_close($con);

Im not sure without seeing you database table but "Gender" is capitalized while the other field names are lowercase.我不确定没有看到您的数据库表,但“性别”是大写的,而其他字段名称是小写的。 Just a shot in the dark here, otherwise your query looks fine.在这里只是在黑暗中拍摄,否则您的查询看起来不错。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM