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 July 17th, 2004, 08:39 PM
Registered User
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lletnek Send a message via Yahoo to lletnek
Default chapter 12 - re-writing

hey everyone im putting the skills to use that i learnt in chapters 11 and 12 and making myself a program just so i remember as much as possible but im having a problem with a certain part...

    $default_sort_order = "ASC";
    $default_order_by = "userID";

    $max_records_page = 25;

    if(empty($order_by)) {

        $order_by_str = "ORDER BY $default_order_by";
        $order_by = $default_order_by;

    }
    else $order_by_str = "ORDER BY $order_by";



    if(empty($sort_order)) {

        $sort_order_str = $default_sort_order;
        $sort_order = 'DESC';

    } else {

        $sort_order_str = $sort_order;

        if($sort_order == 'DESC') {

            $sort_order = 'ASC';

        } else {

            $sort_order = 'DESC';

        }

    }

    $result = mysql_query("SELECT userID, username, user_email, quiz_wins FROM users $order_by_str $sort_order_str");
    $num_records = mysql_num_rows($result);

    $page_num = 1;

    start_border();

    $total_num_pages = $last_page_num = ceil($num_records / $max_records_page);


    echo "<br><center><b>Viewing Users (put in somethin)</b></center><br><table size=\"702\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" align=\"center\">\n\n";

    echo "<tr>\n";

        echo "<td width=\"105\" align=\"center\"><center><b><a href=\"$PHP_SELF?action=view_users&sort_order=$sor t_order&order_by=userID\">User ID</a></b></center><br></td>";

as you can see the code is identical to the book apart from i have used the variable $org_sort_order because i dont need it. you can view this page at http://stargate.lletnek.co.uk/main.p...ion=view_users im just totally baffled because when you click the link to change userid to ascending or descending it just wont change hopefully you can all see what i mean this problem has been bugging me for 2 days! please help... thanks. Tom

Tom Kentell
Website: http://www.lletnek.co.uk
Forum: http://forum.lletnek.co.uk
 
Old July 17th, 2004, 08:50 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Is register_globals on?

Snib

<><
 
Old July 17th, 2004, 09:18 PM
Registered User
 
Join Date: Mar 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to lletnek Send a message via Yahoo to lletnek
Default

nope but i just worked it out lol always happens when i ask for help i fix it one damn line of code fixed 2 days of angst...

global $sort_order, $order_by, $default_order_by, default_sort_order;

im glad its done but that takes the piss lol

thanks anyway mate :)

Tom Kentell
Website: http://www.lletnek.co.uk
Forum: http://forum.lletnek.co.uk
 
Old July 17th, 2004, 09:51 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

LOL.... Glad it's working :-)

Snib

<><





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generics chapter 12 difficult chapter i found ...? Larryz C# 2005 1 July 4th, 2007 09:40 PM
Errors on Chapter 12 example(12.8) sonnie ASP.NET 2.0 Professional 2 June 7th, 2006 10:55 AM
Chapter 12... rrlevron BOOK: Beginning ASP 3.0 2 January 16th, 2006 01:09 AM





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