RE: [PEAR] DataObject: getLink

From: Date: Fri, 08 Aug 2003 18:22:28 +0000
Subject: RE: [PEAR] DataObject: getLink
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-7122@lists.php.net to get a copy of this message
Hello Andy Am Fre, 2003-08-08 um 19.50 schrieb Andy Crain: > Marco, > This might be a typo, but shouldn't you have > "$tb_A->find();" rather than "$content->find();" and in the next line > "while ($tb_A->fetch)" rather than "while ($content->fetch)"? Yes, of course. It was not copy-pasted from my code directly. I tried to make an example. Maybe there is a problem in DataObject since I have to use an older version of it (0.19). I Cannot update because my web hoster only provides a version of php lower than 4.3 and PEAR is not even installed on the server. I have to manage using PEAR on that server myself. Does anybody know if there was a problem with getLink() in version 0.19 of DataObject? While debugging, I found a weird statement on line 220 of DataObject.php in methode get(): $this->$k = $v; Also the statement on line 221 seems to be strange: return $this->find(1); Any ideas? -- Cheers! Marco > > Also, check that your links.ini file has an entry like this: > [tb_C] > id_A = tb_A:id_A > id_B = tb_B:id_B > > Andy > > > > Hello > > > > I have 3 tables that build together a m:n relation. > > > > Table tb_A has a filed (integer) called id_A > > > > Table tb_B has a filed (integer) called id_B > > > > Table tb_C has a filed (integer) called id_C and the keys from table > > A (id_A) and table B (id_B) > > > > My (test-) code looks as follows: > > > > $tb_A = new DataObject_A(); > > $tb_A->id_A = 5; > > > > $content->find(); > > while ($content->fetch()) { > > $c = $tb_A->getLink('id_A', 'tb_c', 'id_A'); > > > > $str = "id_A: " . > > $tb_a->id_A . > > " references in tb_C id_B: " . > > $c->id_B . > > "<br>"; > > > > echo $str; > > } > > > > > > This code does not work as expected. The return from $tb_A->getLink is > > false. > > > > According to the manual, the while-statement should be: > > > > while ($content->find()) { > > ... > > > > but this results in an endless loop. > > > > Can anybody tell me what I am doing wrong, please. I would also be > glad > > the get tips how to process such a m:n relation effectively by using > > DataObject. > > > > Thanks a lot! > > > > -- > > Cheers! > > Marco > > > > > > -- > > PEAR General Mailing List (http://pear.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

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