[DataObject] many to many relationship
| From: | digit Shine | Date: | Wed, 23 Mar 2005 01:31:49 +0000 |
| Subject: | [DataObject] many to many relationship | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-18256@lists.php.net to get a copy of this message | ||
hi,all
How to use getLinks() or getLink() to fetch data from
a many to mary relationship?
There are 3 tables: ph_team.ph_team_user and ph_user,
which user is a member of team.
Table ph_team_user has 2 fields: team_id and user_id,
link to ph_team and ph_user respectively.
my code is:
$team->_id->getLinks();
while($team->_id->fetch()){
$team->_id->getLinks();
echo $team->_id->_user_id->username;
}
Manually user getLink() will be easy to do. But it can
not fetch data into team object, so not good for
smarty. Despite of getLinks() waste more resource.
Appreciate of any feedback.
bitShine d_sunshine@163.com
_________________________________________________________
Do You Yahoo!?
150万曲MP3疯狂搜,带您闯入音乐殿堂
http://music.yisou.com/
美女明星应有尽有,搜遍美图、艳图和酷图
http://image.yisou.com
1G就是1000兆,雅虎电邮自助扩容!
http://cn.rd.yahoo.com/mail_cn/tag/1g/*http://cn.mail.yahoo.com/event/mail_1g/