This is for an RPG game, when a person adventures, i have certain one-time adventures put in the database(for quests). Once a person has encountered this particular adventure, his username, and the id of the adventure is sent to a table(questadvinf). My trouble is that the adventure is not abiding the one-time only rule, and i have no idea why.
PHP Code:
$result120 = mysql_query("SELECT * FROM questadvinf WHERE area='$area' AND username='".$userinf['username']."'", $db);
if(mysql_num_rows($result120)) {
while($retval120 = mysql_fetch_array($result120)){
$result = mysql_query("SELECT * FROM adventinf WHERE area='$area' AND id!='".$retval120['advent_id']."' ORDER BY RAND() LIMIT 1 ", $db);
$retval = mysql_fetch_array($result);
}
}else{
$result = mysql_query("SELECT * FROM adventinf WHERE area='$area' ORDER BY RAND() LIMIT 1 ", $db);
$retval = mysql_fetch_array($result);
}
I've tried so many different ways, and I just cant seem to figure it out.. any help would be greatly appreciated.