Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP 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 September 17th, 2003, 01:47 AM
Registered User
 
Join Date: Sep 2003
Location: Singapore, , Singapore.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Parameter passing

Hi,

I am trying to understand the online polls example shown in the book PHP-MySQL Programming page 286. I guess it is related to the issue of parameter passing between a PHP script and a PHP class. There are 2 elements involved:

1 - ../polls/index.php, a script that calls the function getActivePolls($iCursor) from the class.polls.php to populate dynamically an array called $aPoll. The $iCursor variable is derived from a URL query and can take the value 0,1 or 2 via a $_GET["cursor"]. The array is defined as follows:

$aPoll = $oPolls->getActivePolls($iCursor);

2 - ../class.polls.php, an object class that includes, among others, the above function called getActivePolls(), with one argument $iPage, that retrieves a particular poll from a MySQL table, in the following way:

function getActivePolls($iPage=0) {

$sql = "SELECT poll_id,poll_vote_cnt,poll_question
        FROM tab_polls
        WHERE status=1 AND deleted =0
        ORDER BY created_dt DESC
        LIMIT ".$iPage.",1;

//...some more code to check DB error

 }

My Problem:

I cannot get $iPage to vary dynamically in sync with $iCursor, so as to be able to paginate through all three different polls (for $iPage=0,then 1, then 2), as input for $iCursor itself is derived from a pagination form defined in ../polls/index.php.

Thanks in advance for a clue.






Similar Threads
Thread Thread Starter Forum Replies Last Post
passing parameter sarah lee ASP.NET 1.0 and 1.1 Basics 3 September 5th, 2006 04:29 PM
problem with passing parameter hertendreef ADO.NET 0 June 23rd, 2006 10:00 AM
Passing a Date Parameter ego_mouse BOOK: Professional Crystal Reports for VS.NET 1 January 27th, 2005 08:12 AM
passing parameter.. suzila VB.NET 2002/2003 Basics 7 May 17th, 2004 08:28 PM
Passing Parameter tgopal Javascript 3 August 7th, 2003 07:54 PM





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