0

I have this array from a mysql interrogation:

 $listings = $wpdb->get_results("
        SELECT id, account_id
     FROM {$wpdb->prefix}ebay_auctions
     WHERE status = 'changed'
     ORDER BY id DESC
     LIMIT {$limit}", ARRAY_A );

But i need only middle value from this array, so value from 11 to 20, how can i mod this mysql query?

  • One way to do this is documented In https://stackoverflow.com/questions/1895110/row-number-in-mysql#1895127. See if that works for you. – T Gray Apr 30 '18 at 18:29
  • if is more simple...for me is good to obtain from records 11 to 20 whitout middle... – Vito Santimone Apr 30 '18 at 18:30
  • **WARNING**: This looks [terrifyingly insecure](http://bobby-tables.com/). Are you **sure** your user parameters are [properly escaped](http://bobby-tables.com/php)? Using prepared statements with placeholder values not only solves this problem but means you won’t spend hours chasing a tiny syntax bug due to incorrect escaping. – tadman Apr 30 '18 at 18:31
  • solved using OFFSET 20 – Vito Santimone Apr 30 '18 at 18:39

0 Answers0