如何检查表行是否存在以及是否不成行?到目前为止,我有这个:
$id = $user->getID();
$username = $user->username;
$check = "SELECT id FROM users WHERE nickname = '".$username."'";
$result = mysql_query($check);
if(mysql_num_rows($result)){
$user->parent->mysql->query("INSERT INTO $ngtable (`id`, `namecolor`, `glowcolor`, `bubblecolor`, `bubbletext`, `bubbleglow`, `ringcolor`, `snowglow`) VALUES ('".$id."','0x','0x','0x','0x','0x','0x','0x')");
}else{
$user->parent->mysql->query("UPDATE $ngTable SET namecolor = '0x" . $arg . "' WHERE id = '" . $user->getID() . "'");
$user->sendPacket("%xt%sm%-1%0%$user->username, your name color is now: $arg%");
}