Jump to content

[PHP] Problema extragere date din mysql

Recommended Posts

Am codul acesta:

        $con=mysqli_connect("localhost", "admin", "admin123", "sanandrehax");
        $res=mysqli_query($con, "SELECT * FROM users");
        while($row = mysqli_fetch_array($res)){

            echo "<tr>";
            echo "<td>" . $row['userId'] . "</td>";
            echo "<td>" . $row['userName'] . "</td>";
            echo "<td>" . $row['userEmail'] . "</td>";
            echo "<td>" . $row['userPass'] . "</td>";
            echo "<td>" . $row['userkey'] . "</td>";
            echo "</tr>";


Si sa zicem ca in tabelul users, am urmatoarele randuri:


1   Ion   ion@gmail.com   parola123   1234567890
2   Vasile    vasile@gmail.com   qwerty123   1234123412

Are cineva idee de ce nu imi extrage primul rand din tabel(cel cu username-ul Ion), si incepe cu al doilea(Vasile)?

Edited by Dizzy13
Link to post
Share on other sites
26 minutes ago, MrGrj said:

Daca era sa cauti putin, vedeai ca `mysql_fetch_array` returneaza urmatoru' rand din rezultat. D-aia la tine Vasile e pe primu' loc. Sterge requ' randu' al treilea:





Done, merge ca uns acum:))
Mersi mult, sunt mai nou in PHP, credeam ca prima oara trebuie sa declar $row, si abia dupa sa il folosesc.

Link to post
Share on other sites

Join the conversation

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

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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...