好的,所以我在做一个 mysql 选择,如果没有结果,那么我们将插入它,如果有结果我们更新它,但我收到 Parse 错误:语法错误,意外的 T_VARIABLE
这是我的完整代码
$query = mysql_query("SELECT * from new_battles WHERE player1='".$_SESSION['username']."'");
if(mysql_num_rows($query)!=0)
{# If row already exists, then update it.
$result2 = mysql_query("UPDATE new_battles SET player1 = '"$_SESSION['username']"' AND player2 = '"$_SESSION['vsuser']"'
AND onpokemonplayer1 = '1' AND onpokemonplayer2 = '1' WHERE player1 = '"$_SESSION['username']"' ")
or die(mysql_error());
}
else
{# If row doesn't exist, then insert row.
$result = mysql_query("INSERT INTO new_battles (player1, player2,onpokemonplayer1,onpokemonplayer2) VALUES('"$_SESSION['username']"', '"$_SESSION['vsuser']"' , '1', '1')")
or die(mysql_error());
}
它说错误出现在mysql更新位上......也许我正在使用很多and's ???