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";
}

Instead of it updating where an entry exists it is inserting. My intention is to have it update if there is already the specified $North and $South entry so that there is only one North/South value per map grid.

1 Answer 1

6
$count = mysql_num_rows($result);

If ($Count == 0 )

Is $count $Count ?

captcha: languages that silently initialize new variables when you make a typo

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! i guess i stared at it too long.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.