Tutorial Question: How do I display the values for a many-to-many association

thread: 2 messages  |  last: a year ago  |  started: saturday, february 20, 2010, 4:09 pm pst


#1  |  kingwithin (San Francisco, CA) United States of America
Saturday, February 20, 2010, 4:09 PM PST

I have for each user an association of possible codes through an association table.

I want, for a logged on user, to display all the values of those codes.

Here is the array:

$this->objCodes = $this->objUser->GetGroupCodeArray();

The first value of the array is:

$this->objCodes[0]->SignupCode;

However, I want to display all of the values (and of course be able to surround them with an <a> so that I can display the other Users with the same SignupCode value.

Thanks.

#2  |  Mike Ho (Sunnyvale, CA) United States of America Qcodo Administrator
Sunday, February 21, 2010, 7:47 AM PST

Probably something like this:

    foreach ($this->objUser->GetGroupCodeArray() as $objGroupCode) {
        sprintf('<a href="%s">%s</a>', $objGroupCode->SignupCode, $objGroupCode->SignupCode);
    }

Post with any further questions...



Copyright © 2005 - 2012, Quasidea Development, LLC
This open-source framework for PHP is released under the terms of The MIT License.