Jump to content

Archived

This topic is now archived and is closed to further replies.

Lokolo

DO..LOOP Query not working

Recommended Posts

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

Share this post


Link to post
Share on other sites
Not sure why you wouldn't just do this in MySQL, which also has a rand function.

Share this post


Link to post
Share on other sites
because i didn't know one existed - time for google :P

[edit] still doesn't work though
Parse error: parse error in c:\phpdev\www\register2.php on line 13

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.