This problem really sucks.
If you're using phpMyAdmin or just PHP with a SQL query like:

SELECT * FROM table WHERE state='NY' LIMIT 10

It may or may not work. This is driving all in our office crazy, because logging into MySQL at the command prompt and typing the exact statement directly into the MySQL prompt works everytime!

To make it even more weird... I did a regular browse in phpMyAdmin and copied the statement generated by phpMyAdmin to run, and it did not work! But it works perfectly when I click on Browse in phMyAdmin.

Anyone have any suggestions? What gives?

    Hi,
    the myPHPAdmin puts a suffix of LIMIT NN,MM to end of every query.
    Then sometimes you have a query
    SELECT * FROM table WHERE state='NY' LIMIT 10 LIMIT 100,10 for example.
    This won't work.

    Do this :

    1) Query without LIMIT-clause

    2) and Fetch the result row by row
    for ($i = 0 ; $i <10 ; i++) {
    mysql_result($dbres, $i, "field");
    // output row
    }

    (or similar loops with mysql_fetch_row() ...)

    Regards
    Ingo

      2 months later

      Yes! I have the exact same problem. And I tried the same as you did. It must be a bug, but I can\'t find documentation. The suggestion (fetch row) is okay though.

        2 months later

        Yes, i have this bug too, but it should work fine with the script Ingo gave .

          Write a Reply...