[英]MYSQL PHP Script throwing syntax error
Here is a small sample of code that is giving me a MySQL Syntax Error. 这是给我MySQL语法错误的一小段代码示例。 Connect.php is connecting to the correct database and can be used with other projects and code.
Connect.php正在连接到正确的数据库,并且可以与其他项目和代码一起使用。 I know as a fact that the code in connect.php is correct.
我知道connect.php中的代码是正确的事实。 It is giving me a MySQL Syntax Error about.
它给了我一个MySQL语法错误。 It doesn't give any more detail than this:
没有比这更多的细节了:
You have an error in your SQL syntax;
您的SQL语法有误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'keys WHERE
key
='xxxxxxxxxxxx'' at line 1检查与您的MySQL服务器版本对应的手册以获取正确的语法,以在第1行的'keys WHERE
key
='xxxxxxxxxxxx'附近使用
I pulled this small sample of code from the main project and it still throws the error. 我从主项目中提取了这一小段代码示例,但它仍然引发错误。
<?php
require "connect.php";
$keyCheck = mysql_query("SELECT * FROM keys WHERE `key`='".$_POST['betakey']."'" , $con);
if (!$keyCheck) {
echo mysql_error();
exit;
} else {
$keyRows = mysql_num_rows($keyCheck);
if ($keyRows == 0) {
echo "This key is invalid!";
exit;
}
?>
EDIT: I got the admin to rename the table and you guys helped me fix some potential security hazards. 编辑:我让管理员重命名了表,你们帮助我修复了一些潜在的安全隐患。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.