Re: PHP Pear DB

From: Date: Thu, 31 Jul 2008 22:58:56 +0000
Subject: Re: PHP Pear DB
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-29117@lists.php.net to get a copy of this message
Hey Guys, Thanks for all of your answers. I actually did refer to the documentation like I said in the following page: http://pear.php.net/package/DB/docs/latest/DB/DB_common.html and have searched for a way to list the columns/fields of a table. The method getListOf("tables") only returned the available tables which is not what I needed and I also tried the tablesInfo() method though I either over-looked it's output or for some reason concluded it didn't do what I need. I in turn achieved the result using the following code: $row = $res->fetchRow(DB_FETCHMODE_ASSOC); foreach($row as $key=>$value) { // $key is the table field and $value is the field's value $tableFields .= "$key, "; } Thank you. Regards, Liran. On Thu, Jul 31, 2008 at 4:45 PM, Mike D'Ambrogia <miked@jamagination.com>wrote: > <?php > echo "<h2>brute force</h2>"; > $objPage = DB_DataObject::factory('page'); > foreach($objPage as $key => $value) { > if ((substr($key,0,1) != "_") and (substr($key,0,1) != "N")) { > print $key . "<BR>"; > } > } > > echo "<h2>PEAR table()</h2>"; > echo "<pre>"; > print_r($objPage->table()); > echo "</pre>"; > ?> > > > > On 7/31/2008 2:47 AM, liran tal wrote: > >> Hey, >> >> Is there a method available in the class to list the fields/columns of a >> given database table? >> I'm not seeing any unique class for that in the documentation. >> >> >> Regards, >> Liran. >> > > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

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