"您的SQL语法中的错误. [英] " error in your SQL syntax .. near 'key' "
本文介绍了"您的SQL语法中的错误.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在执行此特定的php脚本时遇到错误,我不知道它可能有什么问题.
i get an error while executing this particular php script and i have no clue what could possibly be wrong with it.
错误代码:您的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册以获取正确的语法,以在第1行的'key ='value'附近使用
Error code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key='value'' at line 1
Php代码:
<?php
include("includes/onbowlconnect.php");
$key = $_GET['key'];
$query = mysql_query("SELECT * FROM bowlvalidkeys WHERE key='$key'") or die (mysql_error());
$result = mysql_num_rows($query);
if($result == 1)
{
echo 'GameIDkey was succesfully validated !';
}
else
{
echo 'GameIDkey is not valid , please try again';
}
?>
有人可以帮我吗?
谢谢!
推荐答案
key
被保留在此关键字周围使用反引号
use backticks around key this
SELECT * FROM bowlvalidkeys WHERE `key` ='$key'
这篇关于"您的SQL语法中的错误.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文