Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 25th, 2013, 09:38 AM
Registered User
 
Join Date: Oct 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 12 userview.php pagination problem solved

Just dived into this book after several years on the shelf for a specific project. As others have posted I was having trouble with the pagination. The same set of database record kept loading whenever [Next] or [Bottom] was clicked.

I realised it was because whenever the list_records function was called from a query string the global $cur_page variable was initialised all over again thus ignoring the value passed in the query string!

To get over this I removed the $cur_page variable from the global declaration and added the following just after the remaining global variable declarations:

PHP Code:
if (!isset($_GET['cur_page'])) {
        
$cur_page 0;
    } else {
        
$cur_page $_GET['cur_page'];
    } 
So now this checks if the $cur_page variable is not(set and not null) in the superglobal array $_GET. If this is the case it is initialised with 0. If not then it is assigned to the value passed in the query string thus preserving the value intended.

Hope that is clear and helps someone who may be pulling their hair out as I was!
 
Old October 29th, 2013, 07:09 AM
Registered User
 
Join Date: Oct 2013
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

_All_ I need to do now is figure out why the columns don't sort and the view_record function does not work - haha!
Think it may the the global declarations again.





Similar Threads
Thread Thread Starter Forum Replies Last Post
chapter 12 modified register.php problem GOUR CHANDRA PAUL BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 June 6th, 2006 03:41 PM
chapter 12 modified register.php problem GOUR CHANDRA PAUL BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 0 April 27th, 2006 02:14 PM
begin php & mysql - chapter 12, user_form.php jon_stubber Beginning PHP 1 March 9th, 2006 10:57 AM
Chapter 12 - useraccount.php buzzuh BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 3 September 3rd, 2004 02:53 PM
Table join problem Chapter 12, p 436 PHP-Beg tomasz BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 2 August 31st, 2003 12:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.