php7 mysql5.7 表单处理问题
HTML5
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title></title>
<style type="text/css">
</style>
</head>
<body>
<form method="post" action="Log_in.php">
<table style="height:150%; width:100%;" border="0">
<tr><td align="center" valign="middle">帐号:<input type="text" name="id"></td></tr>
<!-- <tr><td align="center" valign="middle">密码:<input type="password" name="password"></td></tr> -->
<tr><td align="center" valign="middle"><input type="submit" name="submit" value="登录"></td></tr>
</table>
</form>
</body>
</html>
PHP
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"
</head>
<body>
<?php
$id=$_POST["id"];
// $password=$_POST["password"];
$mysql = mysqli_connect("localhost","root","********f","pies");
if (!$mysql){die("数据库连接失败". mysql_error());}
$account=mysqli_query($mysql,"SELECT * FROM `id_resume` WHERE Cell_phone_number=`$id` ");
if(!$account){die("帐号或密码错误");}
die("欢迎你回来!");
mysql_close($mysql);
?>
</body>
</html>
$id=$_POST["id"]; 这里接收一个表单
$account=mysqli_query($mysql,"SELECT * FROM `id_resume` WHERE Cell_phone_number=$id ");这里是查询mysql中变量表单传上来的数据变量$id
假设表单传上来的值为 ABCD 且mysql中确实有这个值
我在执行过程中发现直接用变量$id查询结果总是失败 但是如果我把查询函数的Cell_phone_number=$id 改为Cell_phone_number="ABCD"执行就能成功,求前辈解释下是为什么或者告诉我看下要去那里找资料 我在提问是已经问过度娘了 谢谢!