RE: [PEAR] DB_DataObject how to iterate through a table?

From: Date: Mon, 16 Feb 2004 09:15:50 +0000
Subject: RE: [PEAR] DB_DataObject how to iterate through a table?
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10714@lists.php.net to get a copy of this message
Hi! > -----Original Message----- > > I am testing DB_DataObject and wondering how to iterate > through a table. > What I tried is: > > $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? Does it work? What do you expect? I expect it to work. If you do not use "selectAdd()" at all, "*" will be selected. Therefore you need to do: $Termin->selectAdd(); $Termin->selectAdd('termin_id'); if you want to select less than everything ... regards Daniel - graduate from university of applied sciences Esslingen :-)

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