mysql - having an issue with php dropdown menus -
so i'm working on project requires users select dropdown menu. using following code can manage slots 1 & 2 display value. inserting other slots value of 0 working, not displaying values. if isn't clear enough please let me know , can try provide more information. code follows;
echo' <br/> slot 1 <select name="slot1">'; while($row = mysqli_fetch_array($result) , $i<10) { echo"<option value='"; echo$row['playerid']; // sorry inverted commas trickys echo"'>"; echo $row['name']; echo "</option>"; $i=$i+1; } echo '</select>'; echo' <br/> slot 2 <select name="slot2">'; $i=1; while($row = mysqli_fetch_array($result) , $i<10) { echo"<option value='"; echo$row['playerid']; // sorry inverted commas trickys echo"'>"; echo $row['name']; echo "</option>"; $i=$i+1; } echo '</select>'; echo' <br/> slot 3 <select name="slot3">'; while($row = mysqli_fetch_array($result) , $i<10) { echo"<option value='"; echo$row['playerid']; // sorry inverted commas trickys echo"'>"; echo $row['name']; echo "</option>"; $i=$i+1; } echo '</select>'; echo' <br/> slot 4 <select name="slot4">'; while($row = mysqli_fetch_array($result) , $i<10) { echo"<option value='"; echo$row['playerid']; // sorry inverted commas trickys echo"'>"; echo $row['name']; echo "</option>"; $i=$i+1; } echo '</select>'; echo' <br/> slot 5 <select name="slot5">'; while($row = mysqli_fetch_array($result) , $i<10) { echo"<option value='"; echo$row['playerid']; // sorry inverted commas trickys echo"'>"; echo $row['name']; echo "</option>"; $i=$i+1; } echo '</select>';
you have reset $i value 1 before others slot:
$i=1;
or have think again how fill slot, same query ? wan same values each slot? in case need: mysqldataseek
Comments
Post a Comment