Jump to content

Skipping first line of db


TapeGun007
Go to solution Solved by mac_gyver,

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.