DataObject: getLink
| From: | Marco Schuler | Date: | Fri, 08 Aug 2003 15:33:35 +0000 |
| Subject: | DataObject: getLink | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-7110@lists.php.net to get a copy of this message | ||
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