Ok. It's me again, but I'm really confused as to how the forum works. Turns out we got this account when we signed up and I failed to notice. The activation e-mail didn't send so I looked through all my e-mail addresses and discovered this one existed.
Anyway, the code:
I don't know why it's not working right, and I've almost given up entirely. Any help at all would be great, even if it's criticizing. I believe all criticism is constructive.
$name = generatename(); //Generate random island name.
$islandsize = $size_id * 10; // Turn the size ID into the islands actual size. ### NEEDS CLEANED UP ALONG WITH SIZE GENERATION ###
mysql_select_db("spacepirates");// Select the required database.
$result = mysql_query("SELECT * FROM islands WHERE island_name = '$name'"); //Check if name already exists.
$no = mysql_num_rows($result); // Check if name exists.
IF($no==1) // If it does exist, notify admin.
Echo("The Island Name '$name' already exists. Island will be regenerated"); //Notify admin island exists already exists.
$loopcount--; // Make sure the loop will run again. This ensures we're always generating 100 islands per run of the script.
ELSE //If it doesn't already exist:
mysql_query("INSERT INTO islands (island_name, island_size, island_type, island_oreM, island_bootyM, island_techM) VALUES ('$name', '$islandsize', '$type', '$oreM', '$bootyM', '$techM' )");
// ^^ Insert island details into the database! :D