Yes but the first 10 rows may or may not be the correct information to post....
Post 1 = "test1 Post 2 = "test2" Post 3 = "re: test1" Post 4 = "test3" ... Post 11 = "re test1" I think that illustrates what I mean. Thanks for your help Alex "Ed Lazor" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You're basically paging through results. You have a SQL statement to get > the data - just limit the statement to only draw information applicable to > the page you're on. Like this: > > select * from table limit 0,10; > > That will select the first 10 records. > > Then you can use variables. > > if (empty($P)) > $P = 0; > $C = 10; > > select * from table limit $P, $C > > Make a link at the bottom > > $NextPage = $P + $C; > if ($P > $C) > $PreviousPage = $P - $C; > else > $PreviousPage = 0; > > print "<a href='next.php?P=$NextPage'>Next Page</a>"; > > You get the idea... > > > > -----Original Message----- > From: Alexander Ross [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 08, 2002 6:22 PM > To: [EMAIL PROTECTED] > Subject: [PHP] tree structures > > > I am creating a message board (pretty standard) using php and mysql. In > order to manage all the posts and replies I am using a treenode structure > (so that I can recursively add, delete, display, etc...) Everything works so > far (www.bleen.net/forum). I want to be able to display 10 posts (including > relies in that count) at a time; then have a next link and display the next > 10 (you've all seen it before). How do I modify a recursive function to > stop and start? My display finction is listed below. > > Thanks > Alexander Ross > > function display($row, $start = 0) > { //display the tree > if($this->m_postid<>0) > { // if this is the empty root node skip displaying > print "<tr><td bgcolor="; > if ($row%2 == 0) > print "'#cccccc'>"; > else > print "'#ffffff'>"; > > // indent replies to the depth of nesting > > print "<img src='images/spacer.gif' height=22 > width=".(22*$this->m_depth)." alt='' valign = bottom>"; > print " <a name = $this->m_postid ><a href = > 'view_post.php?postid=$this->m_postid'>"; > if ($this->m_depth == 1) > print "<b> '$this->m_title' - $this->m_poster > <i>(".reformat_date($this->m_posted).")</i></b></a>"; > else > print "'$this->m_title' - $this->m_poster > <i>(".reformat_date($this->m_posted).")</i></a>"; > print "</td></tr>"; > } > // increment row counter to alternate colors > $row++; > > $num_children = count($this->m_childlist); > for($i = 0; ($i<$num_children); $i++) > { // call display on each of this node's children > $row = $this->m_childlist[$i]->display($row); > } > > return ($row); > } > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > **************************************************************************** > This message is intended for the sole use of the individual and entity to > whom it is addressed, and may contain information that is privileged, > confidential and exempt from disclosure under applicable law. If you are > not the intended addressee, nor authorized to receive for the intended > addressee, you are hereby notified that you may not use, copy, disclose or > distribute to anyone the message or any information contained in the > message. If you have received this message in error, please immediately > advise the sender by reply email and delete the message. Thank you very > much. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php