On Sun, Aug 31, 2008 at 8:09 PM, Evert Lammerts <evert.lammerts@xxxxxxxxx>wrote: > Can you send over the function ProfileList::render? And you should > make sure that whenever the render() function of one of ProfileList's > subclasses is called, the value of $count is 30... It seems the most > likely source of your problem to me. To check the value of $count you > can do and echo $count; or var_dump($count); in the > ProfileList::render() function. > Hmm, I'm no guru but I thought it may have been some incompatibility I'd need to change so it worked on a newer PHP than was on the old server. This code has remained unchanged and working perfect for at least 3 years that I know of. I never changed a single byte of it when moving servers except the new db connection parameters. COUNT and $count look like they have different roles to me, COUNT is the amount of designers to be listed per page, $count is the number of designers to be listed altogether, so 150 designers would give me 5 pages of 30 designers. Anyway, I did not write the code and I don't pretend to understand all of it, so I'm including most of the file here so you can pick what you need :) Note that that RegionSelector() and SpecSelector() work fine. And that AllProfiles() , ProfilesByRegion() and ProfilesBySpec() are the ones that now do not work any more - these three that do not work are part of the ProfileList Class, so I thought it would be something in this class as they are all common to it. I had also read the the re-use of $this had changed in PHP5.2+ but I can not work out if this (npi) would apply in this case. > > > Make sure to always include the list in your replies. This way people > can reuse solutions from the archives. Sorry about that, most lists I'm subscribed to have reply-all set automatically. Here the code :- // Number of designers to display per page on the list.php page. define( "COUNT", 30 ); // Makes DB present for ALL client scripts / pages. // This is a global scope variable. To minimize memory // usage the $db variable is passed by reference, and not // copyied for each function or object. $db = new db( DBUSER, DBPASS, DBNAME ); // The RegionMultiSelector class creates the form conponent // responsible for the input of the designers regions. // Appears on the "Get Listed" page. class RegionMultiSelector { var $html; function RegionMultiSelector( &$db ) { // Create query to get all regions in "regions" database table. $q = "SELECT id, name FROM regions"; // Run the query on the database. $db->runquery( $q ); // Start collecting HTML. $h = "<select ".BC." name=\"regions[]\" multiple=\"multiple\" size=\"7\">\n"; // For each row in the results print the region while( $row = $db->getrow() ) { $h.="\t\t<option value=\"$row->name\">$row->name</option>\n"; } $h.="</select>\n"; $this->html = $h; } function render() { print $this->html; } } // The RegionSelector is a drop down list for selecting singular // regions. For purposes of filtering lists etc. class RegionSelector extends DropNav { function RegionSelector( &$db ) { $q = "SELECT id, name FROM regions"; $db->runquery( $q ); $this->addItem( "", "Please select..." ); while( $row = $db->getrow() ) { $this->addItem( $PHP_SELF."?region=".$row->id, $row->name ); } } function renderBody() { print "<h5 ".BBC.">Select developers based on region.</h5>"; print "<div ".BC.">"; DropNav::renderBody(); print "</div>"; } } // The SpecSelector is a drop down list for selecting singular // specialities. For purposes of filtering lists etc. class SpecSelector extends DropNav { function SpecSelector( &$db ) { $q = "SELECT id, name FROM specialities"; $db->runquery( $q ); $this->addItem( "", "Please select..." ); while( $row = $db->getrow() ) { $this->addItem( $PHP_SELF."?spec=".$row->id, $row->name ); } } function renderBody() { print "<h5 ".BBC.">Select developers based on Speciality.</h5>"; print "<div ".BC.">"; DropNav::renderBody(); print "</div>"; } } // The Profile List is the base class for all Profile lists. // Subclasses must at least define the query class ProfileList { var $query; var $des; var $lastcount; // Render the Brief HomePage list // &$db is a reference to the database object created for the page. function render( &$db, $start=0, $count=1024 ) { if ( ( $this->query=="" ) or ( ! $this->query )) print "<p>Hey, you! You forgot to define a query in my subclass: Yours <i>ProfileList</i></p>"; $q = $this->query; $q = $q." LIMIT $start, $count "; // print "<h1>Query: $q</h1>"; $db->runquery( $q ); $this->lastcount = $db->numrows; if ( $db->numrows > 0 ) { $this->setView(); // Loop through each designer in the database query results. while( $row = $db->getrow() ) { // Load up our designer object from the database selected by ID $this->des->load( $row->id, $db ); // Tell the designer object to print itself in brief form $this->des->render(); } } else { print "<p ".BC.">no developers were found for this query.</p>"; } } // Default View is Brief, but subclasses may override this. function setView() { // Create a new Designer View Object to represent each designer visually. // (One will do, we can reuse these) $this->des = new DesignerBriefView(); } } class AllProfiles extends ProfileList { function AllProfiles() { $this->query = "SELECT id FROM designers WHERE view=1 ORDER BY id ASC"; } function render($db, $start=0, $count=1024) { $db2 = $db; print "<h5 ".BBC.">Listing all developers in order of sign up.</h5>\n"; ProfileList::render( $db2, $start, $count ); } } class ProfilesBySpec extends ProfileList { var $_spec; function ProfilesBySpec( $spec_id ) { $this->_spec = $spec_id; $this->query = "SELECT d.id AS id FROM designers d, designer_spec ds "; $this->query.= "WHERE ds.spec_id=$spec_id AND ds.designer_id=d.id "; $this->query.= "AND d.view=1 "; $this->query.= "ORDER BY d.id ASC "; } function setView() { // Create a new Designer View Object to represent each designer visually. // (One will do, we can reuse these) $this->des = new DesignerConciseView(); } function render(&$db, $start=0, $count=1024) { print "<h5 ".BBC.">Developers Selected on Speciality: "; $q = "SELECT name, html FROM specialities WHERE id=$this->_spec"; $db->runquery( $q ); $row = $db->getrow(); print $row->html; print "</h5>\n"; ProfileList::render(&$db, $start, $count); } } class ProfilesByRegion extends ProfileList { var $_region; function ProfilesByRegion( $region_id ) { $this->_region = $region_id; $this->query = "SELECT d.id AS id FROM designers d, designer_regions dr "; $this->query.= "WHERE dr.region_id=$region_id AND dr.designer_id= d.id "; $this->query.= "AND d.view=1 "; $this->query.= "ORDER BY d.id ASC "; } function setView() { // Create a new Designer View Object to represent each designer visually. // (One will do, we can reuse these) $this->des = new DesignerConciseView(); } function render(&$db, $start=0, $count=1024) { print "<h5 ".BBC.">Developers Selected on region: "; $q = "SELECT name FROM regions WHERE id=$this->_region"; $db->runquery( $q ); $row = $db->getrow(); print $row->name; print "</h5>\n"; ProfileList::render(&$db, $start, $count); } } > > > Evert > > On Sun, Aug 31, 2008 at 11:21 AM, Gav <ipv6guru@xxxxxxxxx> wrote: > > Hi All, > > > > I moved a site across from one server to another, and now there is one > thing > > no longer working properly that worked fine on the other. It may turn out > to > > be a PHP4 to PHP5 problem, dont know as I cant access now what the other > > server had. > > > > Certain pages on the website were able to render a list of 30 items, > since > > the move it now only renders the first item only. > > > > I'm sure you want some code, but before I give that can we determine if > I'm > > on the right list - the function does pull items from a database so it is > > sort of related, though I'm not sure it is a db problem. > > > > In the php output page we have > > > > $list->render( $db, $start, COUNT ); > > > > Not sure if that is a clue or not, anyway let me know if you me to post > all > > the related classes and functions. > > > > Cheers > > > > Gav... > > > -- Gav... [LinkedIn : http://www.linkedin.com/in/ipv6guru] www.16degrees.com.au | www.iwdp.co.uk | www.minitutorials.com (Sponsorship slots available on above three sites!)