<?php
$con=mysqli_connect("localhost","root","123456","astralms");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$username = htmlspecialchars(mysql_real_escape_string($_GET['username']));
$result = mysqli_query($con,"SELECT * FROM accounts WHERE name = '$username'");
while($row = mysqli_fetch_array($result))
{
echo $row['gm'];
echo "<>";
echo $row['vpoints'];
echo "<>";
echo $row['ACash'];
}
?>
这是我的代码。所有的信息都是100%正确的。但是,即使我输入了密码,它的行为就像我没有。由于某种原因拒绝用户'@'localhost'(使用密码:NO)的访问?
这是为什么? 谢谢!
什么是我必须使用mysqli_real_escape_string的第二个参数?我在网上找到了答案,但是“链接”是什么? –
@JohnReakon连接链接,你需要使用'$ con' –