Lokolo Posted October 15, 2006 Share Posted October 15, 2006 Pastebin being a pain.<?phpsession_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 Link to comment https://forums.phpfreaks.com/topic/24024-doloop-query-not-working/ Share on other sites More sharing options...
fenway Posted October 15, 2006 Share Posted October 15, 2006 Not sure why you wouldn't just do this in MySQL, which also has a rand function. Link to comment https://forums.phpfreaks.com/topic/24024-doloop-query-not-working/#findComment-109176 Share on other sites More sharing options...
Lokolo Posted October 16, 2006 Author Share Posted October 16, 2006 because i didn't know one existed - time for google :P[edit] still doesn't work thoughParse error: parse error in c:\phpdev\www\register2.php on line 13 Link to comment https://forums.phpfreaks.com/topic/24024-doloop-query-not-working/#findComment-109717 Share on other sites More sharing options...
.josh Posted October 16, 2006 Share Posted October 16, 2006 [code]$isitfree = mysql_query("SELECT free FROM map WHERE ID = '$mapcoord'")[/code] Link to comment https://forums.phpfreaks.com/topic/24024-doloop-query-not-working/#findComment-109757 Share on other sites More sharing options...
Lokolo Posted October 17, 2006 Author Share Posted October 17, 2006 same error heh, makes no sense to me :-/ Link to comment https://forums.phpfreaks.com/topic/24024-doloop-query-not-working/#findComment-110141 Share on other sites More sharing options...
LazyJones Posted October 17, 2006 Share Posted October 17, 2006 would ; in end of the line do the trick? Link to comment https://forums.phpfreaks.com/topic/24024-doloop-query-not-working/#findComment-110187 Share on other sites More sharing options...
Lokolo Posted October 18, 2006 Author Share Posted October 18, 2006 lol thats hated. :) Link to comment https://forums.phpfreaks.com/topic/24024-doloop-query-not-working/#findComment-110712 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.