Re: Paged Results Set in MySQL DB with one result

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Phillip S. Baker wrote:
Greetings Gents,

I have an interesting problem I would like some ideas on for a solution.
I cannot seem to find any code examples on the net, though I might not be looking in the right place really.

I have some articles stored in a MySQL DB.
What I want is if the article is above a certain length in characters, to page article through a few pages for site readability.

So I would want to print X number of words/characters.
Save the where the pointer is, move on to the next page, and display the same amount and so on for as many pages as needed.

I know about pulling paged results using the limit function but that would not seem to apply as really I would want to page the results within one record (one field really).

Does anyone have any ideas??

Apart from the other suggestions, you could modify your design a little bit.

Instead of just having an articles table, you have an articles table and an article_pages table.

Each "page" of your article is stored separately in the database and you don't have to do anything fancy to do your paging.

create table articles(
  articleid int primary key,
  subject varchar(255),
  introduction text <-- maybe? maybe not
........
);

create table article_pages (
  pageid int primary key,
  articleid int, <-- points to the articles table
  content text,
  sortorder int
........
);

simple join between the tables to get what you need..

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux