Author Topic: PHP select issue  (Read 627 times)

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
PHP select issue
« on: January 13, 2022, 01:28:01 am »
Hi

I display 20 rows per page. When going to next page and perform a search the SQL Query will be:

Code: [Select]
SELECT * FROM [table] where id like CONCAT('%', '123', '%') LIMIT 20, 20;
This will give 0 rows returned if there is less than 20 rows returned (1 for example)...how can I address this?

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6310
    • View Profile
Re: PHP select issue
« Reply #1 on: January 13, 2022, 11:17:11 am »
If you are performing remote paging then you should return curPage property in the response indicating current page. there should be a check in the remote script so that curPage doesn't exceed total number of pages.

If total rows is 1, then return

{ totalRecords: 1, curPage: 1, data: [....] }

If total rows is 0, then return

{ totalRecords: 0, curPage: 1, data: [] }
« Last Edit: January 13, 2022, 12:55:28 pm by paramvir »

queensgambit9

  • Pro Ultimate
  • Sr. Member
  • *
  • Posts: 341
    • View Profile
Re: PHP select issue
« Reply #2 on: January 14, 2022, 01:50:51 am »
Thanks, had some error in my PHP for getting data.