How can I check if the table row exists and if it doesn't make a row? So far I have this:
$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%");
}
if/elseblocks, since whenif(mysql_num_rows($result))== true, the id exists in users, so you want to do the update, else id doesn't exist in user so you need to do an insert?