Jump to content

Is this even possible?


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>

Edited by Faracus
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...