include "connect.php";
$deck = addslashes($_GET['deck']);
$side = addslashes($_GET['side']);
$type = addslashes($_GET['type']);
$by = addslashes($_GET['creator']);
$name = addslashes($_GET['name']);
$table = "deck";
$result = mysql_query("SELECT * FROM $table WHERE name = '$name' AND by = '$by'");
if(!$result){
$query2 = "INSERT INTO $table (deck, side, name, type, by) VALUES ('$deck', '$side', '$name', '$type', '$by')";
$result2 = mysql_query($query2);
}
插入到永不插入,我的数据库就像
id int(11) autoincrement
deck varchar(900)
side varchar(900)
type varchar(900)
by varchar(900)
name varchar(900)
答案 0 :(得分:1)
by是保留关键字。
像这样使用
$result = mysql_query("SELECT * FROM $table WHERE name = '$name' AND `by` = '$by'");