J
J
jekanok2016-03-05 10:58:59
MySQL
jekanok, 2016-03-05 10:58:59

How to make a limit not from the beginning?

$result = mysql_query("SELECT * FROM ads WHERE balans >= for_one and user != '$user' and type = '$ads_jobs' ORDER BY for_one DESC",$db); //Вытаскиваем из таблицы 5 комментариев начиная с $num
  if(mysql_num_rows($result) > 0){	
  while($qwe = mysql_fetch_array($result)){
    $num = mysql_num_rows(mysql_query("SELECT id FROM ads_views WHERE user = '$user' and ad_id = '$qwe[link_id]'",$db));
  if($num==0){

The problem is that when I write LIMIT 0.10, it displays only the first 10 records, but how can I do it to display not the first 10 records, but, for example, from 22 records?
i think you can understand

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-03-05
@alexey-m-ukolov

I seem to be able to :

To retrieve all rows from a certain offset up to the end of the result set, you can use some large number for the second parameter. This statement retrieves all rows from the 96th row to the last:
SELECT * FROM tbl LIMIT 95,18446744073709551615;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question