Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9
This is the forum to discuss the Wrox book PHP and MySQL: Create-Modify-Reuse by Timothy Boronczyk, Martin E. Psinas; ISBN: 9780470192429
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old October 19th, 2009, 10:28 PM
Authorized User
Points: 374, Level: 6
Points: 374, Level: 6 Points: 374, Level: 6 Points: 374, Level: 6
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2009
Location: San Jose, Californina
Posts: 77
Thanks: 4
Thanked 6 Times in 6 Posts
Default Chap 2 forums, pagination issues page 55-56

There are some issues in the Pagination section pages 55-56.
I used the code in the book. Once I cleared up these issues
the pagination worked. I had a previous post on the testing
scripts I used.


ISSUE #1

The book has

Code:
mysql_data_seek($start);
This is not correct; it takes 2 arguments. It should be

Code:
mysql_data_seek($result,$start);
($result is from mysql_query)

The download code is correct

ISSUE # 2

The book has

Code:
while( $row = mysql_fetch_assoc($result) && $count++ < $display)
This is not correct. There needs to be parenthesis around
the $row = mysql_fetch_assoc($result)
It should be

Code:
while( ($row = mysql_fetch_assoc($result)) && $count++ < $display)
The download code changed it to put $count++ < $display in front. that is

Code:
while ($count++ < 25 && $row = mysql_fetch_array($result))
Now, I would rather not have the 25 hard coded like this. I would
rather have a $display variable like they do in the book.


ISSUE # 3

Spelling error. Both the book and download code have it wrong
Code:
// Generate the paginiation menu
Should be
Code:
// Generate the pagination menu
ISSUE # 4

In the book it has $form_id instead of $forum_id
This happens in two places.
It is in the //Generate the pagination section

Code:
echo '<a href="view.php?fid=' . $form_id . '&start=0">' .
                 'FIRST</a> &nbsp&nbsp';
It should be

Code:
echo '<a href="view.php?fid=' . $forum_id . '&start=0">' .
                  'FIRST</a> &nbsp&nbsp';
and the second place is

Code:
echo '<a href="view.php?fid=' . $form_id . '&start=' .
                 ($total - $display) . '">LAST</a> ';
It should be

Code:
echo '<a href="view.php?fid=' . $forum_id . '&start=' .
                 ($total - $display) . '">LAST</a>';
The download code is a little different. It leaves out FIRST and LAST.
It does have it spelled correctly.

ISSUE # 5

The pagination menu needs more space between the links. Currently
they are crammed together.

I solved it by adding &nbsp&nbsp after the </a>

Code:
echo '<a href="view.php?fid=' . $forum_id . '&start=0">' .
                 'FIRST</a> &nbsp&nbsp';
      echo '<a href="view.php?fid=' . $forum_id . '&start=' .
                 ($start - $display) . '">&lt;PREV</a> &nbsp&nbsp';
   }
   if ($total > ($start + $display))
   {
      echo '<a href="view.php?fid=' . $forum_id . '&start=' .
                 ($start + $display) . '">NEXT&gt;</a> &nbsp&nbsp' ;
      echo '<a href="view.php?fid=' . $forum_id . '&start=' .
           ($total - $display) . '">LAST</a> ';
ISSUE # 6

The book shows us how to implement this pagination for the messages.
It does not implement pagination for number of forums or replies.
I guess that's reasonable, they showed us how to do it, and we can
implement it on our own for forums and replies.


ISSUE # 7

The book uses FIRST PREV NEXT LAST whereas the download code uses
just PREV NEXT

It seems having the FIRST PREV NEXT LAST is preferable because you can get to the beginning or end quickly.
__________

Like I say, after I fixed these issues the pagination was working for me.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 2 forums, testing the pagination section kenj BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 0 October 19th, 2009 09:49 PM
Hyperlink on page 55 rhoss BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 3 July 6th, 2008 02:12 PM
Access 2003 VBA PG 55-56 KellyR Access VBA 3 June 9th, 2007 09:32 AM
ZVON Tutorial Page 56 id() function scubaduba XSLT 1 November 1st, 2004 12:37 PM
Page 55. Working with 3 projects? BradDotNet BOOK: ASP.NET Website Programming Problem-Design-Solution 1 July 24th, 2003 01:52 PM



All times are GMT -4. The time now is 01:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.