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条目,则更新它,以便每个地图网格只有一个北/南值。

4

1 回答 1

6
$count = mysql_num_rows($result);

If ($Count == 0 )

$count $Count吗?

验证码:当你打错字时默默初始化新变量的语言

于 2013-03-14T23:35:35.897 回答