Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Question for David Powers about displaying of a subset of records

Guest
Apr 05, 2010 Apr 05, 2010

Copy link to clipboard

Copied

David,

I have used your fantastic book, PHP Solutions to great success in developing my own projects.

My problem is in following your approach for displaying a subset of records from my database. In your book (page 333, php solution 12-4), you use tables, and in my design I am using CSS. Everything works great if I display the entire record set, but when I want to limit the number of records shown on a page, I can't make it work. I'm suspecting that your method using the table was 'self-governing' to the extent that the table was created based on the various parameters of the subset.

I'm not looking for a line-by-line code example, rather I would like to find a resource that might help me shed light on this problem. I have been trying things for hours today, but can not acheive my goal of limiting x-amount of subsets per page.

Any nudge in the right direction would be greatly appreciated.

Sincerely,

wordman

TOPICS
Server side applications

Views

1.7K
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Apr 07, 2010 Apr 07, 2010

The fact that the thumbnails are displayed in a table is irrelevant. What controls the subset of records being retrieved from the database is the code in step 4 at the top of page 335.

$startRow is the current page number (counted from 0) times SHOWMAX (the number of elements you want to show on the page.

That results in the SQL on page 2 being this: "SELECT * FROM images LIMIT 6, 6". ($startRow is 1 * 6).

Votes

Translate
LEGEND ,
Apr 07, 2010 Apr 07, 2010

Copy link to clipboard

Copied

The fact that the thumbnails are displayed in a table is irrelevant. What controls the subset of records being retrieved from the database is the code in step 4 at the top of page 335.

$startRow is the current page number (counted from 0) times SHOWMAX (the number of elements you want to show on the page.

That results in the SQL on page 2 being this: "SELECT * FROM images LIMIT 6, 6". ($startRow is 1 * 6).

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Apr 07, 2010 Apr 07, 2010

Copy link to clipboard

Copied

LATEST

David,

Many thanks for the insight. It helped me understand the problem, which was actually related to some additional query logic I am using.

However, my main hurdle still lies in front of me.

I'll post this in a new thread.

Thank you so much!

Sincerely,

wordman

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines