bbram Posted August 16, 2018 Share Posted August 16, 2018 I have a list that pulls information from a database. This information is pulled dynamically. There are 4 different list and all 4 different list display the exact same thing...the issue is that only the first list is populating items. I have pasted code below as an example for two of the list. <select name="Winning_Player_1" size="1"> <?php $sql=mysqli_query($con, "Select Player_Number, Player_Name from players order by Player_Name"); while ($row = $result->fetch_assoc()) { unset($Winid1, $WinPlayer1); $Winid1 = $row['Player_Number']; $WinPlayer1 = $row['Player_Name']; echo '<option value="'.$Winid1.'">'.$WinPlayer1.'</option>'; }?></select> </td> <td>Winning Player 2 <select name="Winning_Player_2" size="1"> <?php $sql=mysqli_query($con, "Select Player_Number, Player_Name from players order by Player_Name"); while ($row = $result->fetch_assoc()) { unset($Winid1, $WinPlayer1); $Winid1 = $row['Player_Number']; $WinPlayer1 = $row['Player_Name']; echo '<option value="'.$Winid1.'">'.$WinPlayer1.'</option>'; }?></select> Any help is greatly appreciated with this. What I plan on doing is passing each variable to another page and see if the winning players exists and if not then process my next set of code. Quote Link to comment https://forums.phpfreaks.com/topic/307617-not-all-list-are-being-populated/ Share on other sites More sharing options...
requinix Posted August 16, 2018 Share Posted August 16, 2018 You're confusing $sql and $result. Quote Link to comment https://forums.phpfreaks.com/topic/307617-not-all-list-are-being-populated/#findComment-1560361 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.