TapeGun007 Posted October 10, 2016 Share Posted October 10, 2016 Here is my code: <form method="post" action="state.php"> <select name="state" id="state" onchange="this.form.submit()"> <option></option> <?php $sql = "SELECT * FROM States"; $rs=$con->query($sql); $rs->data_seek(0); $row = $rs->fetch_assoc(); while($row = $rs->fetch_assoc()){ $StateID = $row[StateID]; // Check to see which state was selected so it stays in drop down box. if($StateID==$StateSelected){ $selected = " selected"; }else{ $selected = ""; } echo "<option value='".$StateID."'".$selected.">".$row['StateName']."</option>"; } ?> </select> </form> I am befuddled as to why when pulling the state from the db, that the first state Alaska does not show up in the drop down. I double checked that Alaska is in fact in the db as the first entry. I know this has to be one of those stupid things that I am not seeing for some reason. Quote Link to comment https://forums.phpfreaks.com/topic/302310-skipping-first-line-of-db/ Share on other sites More sharing options...
Solution mac_gyver Posted October 10, 2016 Solution Share Posted October 10, 2016 look at your code, between where you are executing the sql query and where you are looping over the data from that query. Quote Link to comment https://forums.phpfreaks.com/topic/302310-skipping-first-line-of-db/#findComment-1538179 Share on other sites More sharing options...
TapeGun007 Posted October 10, 2016 Author Share Posted October 10, 2016 Bwahaha. Ok ok ok. I KNEW it was something very stupid. Thanks man. Something I think I just stare too hard and need another set of eyeballs. Quote Link to comment https://forums.phpfreaks.com/topic/302310-skipping-first-line-of-db/#findComment-1538180 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.