Faracus Posted March 27, 2012 Share Posted March 27, 2012 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 More sharing options...
birbal Posted March 28, 2012 Share Posted March 28, 2012 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 More sharing options...
Faracus Posted March 28, 2012 Author Share Posted March 28, 2012 The last time I tryed something like this, then the values changed between the two, but that could have been me doing it wrong, I'll give it a shot. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.