How to paginate in case of SELECT * AGAINST?

Hi,

When generating a LIST via SELECT AGAINST then LIMIT X, Y does not work.
That is if the SELECT statemenet is like:

SELECT ix_id, title, descpt FROM customers WHERE MATCH (title, descpt)
AGAINST(‘$find’) LIMIT 90, 100

Rather than getting the results from 90 to 100 MySQL returns all 100 results!

So how can one pageinate in case of SELECT * AGAINST?

To put it another way, since MySQL returns all 100 values rather than from
90 to 100 only, how can we then effectively execute:

while ($result_chk_word = mysql_fetch_array($query_chk_word)) {

$url_id = $result_chk_word['ix_id'];
$title = $result_chk_word['title'];
$descpt = $result_chk_word['descpt'];

}

to list results for only 90 to 100?

Regards,

what was the value you used for $find? how many rows were supposed to have been found? how many total rows in the table

Hi,

Well $find can be any value, in this case for Test purposes it is “Money”.
It returns 4372 rows.
Total rows in the Table are in Million+.

So what I would like to do is to for example have it return results from LIMIT 20, 30
but instead it returns all 30. So rather than behaving like a normal SELECT and
return values between LIMIT 20, 30 this type of SELECT returns all values from 0
to 30!

Regards,
dean

well, i don’t know what’s happening, all i can do is guess

try using a subquery…

SELECT *
  FROM ( SELECT ix_id
              , title
              , descpt 
           FROM customers 
          WHERE MATCH (title, descpt) AGAINST('$find') ) AS q
LIMIT 90, 100

I would also include an order by clause to make sure that the results are always returned in the correct order.