Pastebin being a pain. <?php session_start(); include("function.php"); db_sign_in(); $name = $_POST['name']; $password = MD5($_POST['password']); $civ = $_POST['civ']; $email = $_POST['email']; [b]do { srand((double)microtime()*1000000); $mapcoord = rand(0,100); $isitfree = mysql_query("SELECT free FROM map WHERE ($mapcoord = ID)") } while ($isitfree <>1);[/b] $check_query = mysql_query("INSERT INTO accounts VALUES ('$name','$password','$email')"); $add_player_query = mysql_query("INSERT INTO players (name, civ, r1, r2, r3, mapID) VALUES ('$name', '$civ', 100, 100, 100, '$mapcoord')"); if ( $civ = "arthurian" ) { $add_civart_query = mysql_query("INSERT INTO arthurian VALUES ('$name', 100, 100, 100, 5)"); } else { $add_civazt_query = mysql_query("INSERT INTO aztec VALUES ('$name', 150, 150, 60, 5)"); } $_SESSION[registered] = "1"; redirect("0","register.php"); ?> Hm, can't see whats wrong. Basically I need to get a random number 1-100, then check whether this item in the list has free of = 1 or not. Bit complicated, ask if you don't understand parts. Thanks in advance. Lokolo