Jump to content

Is this even possible?


Faracus

Recommended Posts

What I am currently trying to do is get the number of rows that meet a certain criteria, then with the number returned I will need to create a variable that will then grab a value out of those rows and then save them for use in a drop down box, is this even possible, it's giving me quite a headache trying to figure out how to do this.

$result = mysql_query("SELECT rank FROM members", $con);$result = mysql_query("SELECT rank FROM members", $con);$currentrank = mysql_num_rows($result);$i=1;$s=1;$sql = "SELECT * FROM members";$return = mysql_query($sql,$con);{while($row = mysql_fetch_array($return)){while ($i<=$currentrank){$member+$i = $row["username"];$i++;}}}

That's the code I have, but I'm doubting it will work, and even if it does I don't think it will work right. This part is the code for the posting of the actual code for the form

Unit Number of the person to promote <select name='unitnumber' />";while ($s<=$currentrank){echo "<option value='" . $member+$s . "'>" . $member+$s . "</option>";$s++;}echo "</select>

Link to comment
Share on other sites

you dont need to loop thrice.you vcan do something like$return = mysql_query($sql,$con);{while($row = mysql_fetch_array($return)){echo "<option value='" . $row'[member']. "'>" . $row['member'] . "</option>";}

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...