king2k5
09-26-2006, 11:22 PM
This is just an excerpt of code...
<?
if(isset($_GET['area'])){
$result = mysql_query("SELECT * FROM adventinf WHERE area='".$_GET['area']."' ", $db);
if(!mysql_num_rows($result)) {
echo "There is no such area.";
}else{
while($retval = mysql_fetch_array($result)){
$id1 = $retval['id'];
}
}
$id = rand($id1,$id1);
?>
Ok.. so, in the database, there are say, 2 areas with the value of forest. now, click on that area, and it goes to this code, selecting all the rows with that area.. i want it to select the MINIMUM id number, and the MAXIMUM id number of the rows with the value of area that was inputed, then i want it random between the Min and Max.. how would i do that??
<?
if(isset($_GET['area'])){
$result = mysql_query("SELECT * FROM adventinf WHERE area='".$_GET['area']."' ", $db);
if(!mysql_num_rows($result)) {
echo "There is no such area.";
}else{
while($retval = mysql_fetch_array($result)){
$id1 = $retval['id'];
}
}
$id = rand($id1,$id1);
?>
Ok.. so, in the database, there are say, 2 areas with the value of forest. now, click on that area, and it goes to this code, selecting all the rows with that area.. i want it to select the MINIMUM id number, and the MAXIMUM id number of the rows with the value of area that was inputed, then i want it random between the Min and Max.. how would i do that??