On Wed, May 3, 2006 1:51 pm, Phillip S. Baker wrote: > 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). It's pretty much the same as paging through records, but instead of: LIMIT $limit OFFSET $offset you would do: SELECT substring(monster_text, $offset, $limit) FROM whatever You will probably then want to dink around with things so that you don't break your text up in mid-word, but you can do that fairly easy on the PHP end once you have the chunk of text with http://php.net/strrpos: $pos = strrpos($text, ' '); $next_offset = $offset + $limit - ($limit - $pos); $text = substr($text, 0, $pos); There's probably an off-by-one error in that, but you get the idea. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php