hey there

I have two tables in my database, Users & Profiles - (profiles btw are
the sites a user belongs to). A user can have many profiles

So in my users controller I have this:
function index() {
                $this->User->recursive = 0;
                $this->set('users', $this->paginate());

                $username = $this->Session->read('user');

            if ($username) {
              $results = $this->User->findByEmail($username);
              $this->set('user', $results['User']);
                        // get their profiles
                        $user_id = $results['User']['id'];
                        $results = 
$this->User->Profile->findAll('profile.user_id='.
$user_id,  array('fields' => '*'));
                        $this->User->Profile->set('profile', 
$results['Profile']);
            } else {
              $this->redirect(array('action' => 'login'), null, true);
            }
        }

What I'm trying to do is get a list of all profiles for this user.
The code above works, and $results = $this->User->Profile-
>findAll('profile.user_id='.$user_id,  array('fields' => '*')); does
return all the profiles for the given user

Now I want to set this into the user object ... but I can't seem to do
this.
I've now got a page where I get the username etc (their personal page)
and I simply want to say

Hi, Bob

Your Profiles:
* This Site
* That Site
* A Site

I can't seem to get the information out of my user controller to my
index.ctp

Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to