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
条目),以便每个地图网格只有一个北/南值。 最佳答案
$count = mysql_num_rows($result);
If ($Count == 0 )
是
$count
$Count
吗?验证码:输入错误时会默默初始化新变量的语言