0
if ($Funct == "BUILD" AND $Mode == "GROUND")
{
$sql = "SELECT * FROM $landCon WHERE North = '" . $North . "' AND West = '" . $West ."'" ;
$result = mysql_query($sql) or die("Error occurred in [$sql]: " . mysql_error());
$count = mysql_num_rows($result);
If ($Count == 0)
{
$sql = "INSERT INTO $landCon (West,North,Type1) VALUES ($West,$North,'$Char')";
mysql_query($sql) or die("Error occurred in RootA as:[$sql]: " . mysql_error());
}
else
{
$result=mysql_query("UPDATE $landCon SET Type1= '$Char' WHERE North = $North AND West=$West") or die("Database Error: ".mysql_error());
}
echo "SUCCESS";
}
而不是更新它存在的條目插入。如果已經存在指定的$North
和$South
條目,則我的意圖是更新它,以便每個地圖網格只有一個北/南值。爲什麼我的PHP/MySQL插入而不是更新?
謝謝!我想我盯着它太久了。 – WaxyChicken 2013-03-14 23:37:45