if($_GET['action'] == "add"){
if($_SERVER['REQUEST_METHOD'] == "POST"){
if(empty($_POST['bugtitle']) || empty($_POST['bugdetails'])){
echo 'One of the fields was empty! Go back and try again.<br/>';
}
else
{
$query = "INSERT INTO bra
(
bugtitle,
bugdetails,
status,
ip,
)
VALUES
(
'". mysql_real_escape_string($_POST['bugtitle']) ."',
'". mysql_real_escape_string($_POST['bugdetails']) ."',
'0',
'". $_SERVER['REMOTE_ADDR'] ."'
)";
$mysqlquery = mysql_query($query);
if($mysqlquery){
echo 'Bug reported.<br/>';
}
else
{
echo 'Mysql query failed! Please contact the webmaster!<br/>'.mysql_error().'<br/>'.$query;
}
}
}
else
{
?>
<form action="bra.php?action=add" method="post">
Bug title: <input type="text" name="bugtitle"/><br/>
Details:<br/>
<textarea cols="50" rows="5" name="bugdetails"></textarea><br/>
By pressing 'submit' you understand that you will not spam and your ip adress will be logged.<br/>
<input type="submit" value="submit"/>
</form>
<?php
}
}
而这正是它返回:Mysql查询错误:出了什么问题?
MySQL查询失败!请联系网站管理员! 你的SQL语法有错误;检查与您的MySQL服务器版本相对应的手册,以便在''VALUES'附近使用正确的语法'(在第7行有'错误','其呼叫')INSERT INTO胸罩(bugtitle,bugdetails,status,ip,) VALUES( '有一个错误', '而其所谓的玛雅', '0', '127.0.0.1')
有什么不对这个查询?!?
错误说:“有你在附近的语法错误')VALUES(...'”有什么不对您的查询,有你的语法错误时,多余的逗号,就在')VALUES(...'。之前,换句话说,错误消息告诉你到底查询有什么问题, – 2010-12-10 09:57:04