Re: Table joining with DB_DataObject

From: Date: Wed, 19 May 2004 12:48:43 +0000
Subject: Re: Table joining with DB_DataObject
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12600@lists.php.net to get a copy of this message
Hello Ian, If you have no special reason for using join, I'd do this:
[a] userName = b.username
$a =& DB_DataObject::factory('a'); if ($a->find()) { while ($a->fetch()) {
       $a->getLinks();
       print_r($a);
} } Regards, Norbert Ian P. Christian wrote:
Hello all! I'm having issues with getting tables to join with DB_Dataobject. I have a two tables, A and B table a id (key) username table b id (key) username attribute I have a database.links.ini with the following in it... [a] userName = b.username and the following code... $a =& DB_DataObject::factory('a'); $b =& DB_DataObject::factory('b'); $b->Attribute = 'Password'; $a->joinAdd($b); $a->find(); $a->fetch(); Var_Dump::display($a); The error I am getting is 'joinAdd: b has no link with a' Can anyone see what I'm doing wrong? kind Regards, Ian


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