hello!
exactly esterday i had the same problem ;)
& i did it like this, using wordwrap/explode functions:
.......
$CFG_max_page_length = 5000;
.......
  if(@mysql_num_rows($rez) > 0)
  {
   $text  = nl2br(mysql_result($rez,0,"text"));
   $text_length = strlen($text);
   if($text_length > $CFG_max_page_length)
   {
    $page_count = ceil($text_length/$CFG_max_page_length);
    $text = wordwrap($text, $CFG_max_page_length, "__SPLIT__", 0);
    $text_arr = explode("__SPLIT__",$text);
    $p = (!isset($p) || !($p>0)) ? 1 : (int)$p;
    for ($page=1; $page<=$page_count; $page++)
    {
     $pages .= ($page != $p) ? "<a href=$PHP_SELF?a=$a&b=$b&p=$page>$page</a> " : 
"<b>$page</b> ";
    }
    $pages = "<p align=right><b>$STR_pages:</b>&nbsp; $pages</p>";
    $text = $text_arr[$p-1];
  }
................
echo "
$pages
<p>$text</p>
$pages";
................
http://demo.mp.lv/guru/index.php?a=1&b=17&p=1
its upcoming vortal about psyhology/metaphiscs/health in russian
which i afraid i never complete by the deadline.. :/

"Jordan Elver" <[EMAIL PROTECTED]> wrote
>> Hi,
>> I need to split an article over several pages. I know how to create
>> next and
>> previous links for database queries. But how can I pull out say, an
>> article
>> from a database and split the article text over a certain amount of pages
>> depending on the article length, so every 500 words and new page is
>> created?


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to