DB_DataObject how to iterate through a table?

From: Date: Mon, 16 Feb 2004 18:16:44 +0000
Subject: DB_DataObject how to iterate through a table?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10729@lists.php.net to get a copy of this message
$Termin = new DataObject_Termin(); $Termin->find(TRUE); do {
    echo $Termin->termin_id , '<br />';
    echo $Termin->termin_titel, '<br />';
    echo $Termin->termin_datum, '<br />';
    echo '<br />';
} while ($Termin->fetch()); ---------------------- Which iterates through the table 'Termin'. Does this approach has any drawbacks?
I would use the example in the DB_DataObject documentation. Your code above is fine if there is at least 1 record in the table. You should only use "do { ... } while ()" if the code in the loop needs to run one or more times, or "while () {...} " if it is to run zero or more times. HTH, Mark -- Mark Mitchenall, Standingwave Ltd (Complete Hosting and Development Services) Tel := +44 (0)20 8452 3031 Email := mark@standingwave.co.uk mark@mitchenall.com Home := http://www.standingwave.co.uk http://www.mitchenall.com

« previous php.pear.general (#10729) next »