This should work,
$this->set('bookmarkdata',   $this->Image->find('all', 'conditions' =>
array('id'  => $bookmarklist) ) );

On Thu, Nov 6, 2008 at 9:02 PM, wallerdm <[EMAIL PROTECTED]> wrote:

>
> Dear All,
>
> Just a quick question really (hopefully).
>
> I have a load of images stored in a table, each with an ID. Users can
> choose to bookmark images and this is also stored in a table:
>
> --Users----
> id - INT
> username - VARCHAR
>
> --Images----
> id - INT
> title - VARCHAR
> url - VARCHAR
>
> --Bookmarks----
> id - INT
> user_id - INT
> image_id - INT
>
> I now have all of my models set up, including all of the
> relationships, and have all of the data reading correctly. What I'm
> trying to do now is list (as part of the Users controller) all of the
> image titles that they have bookmarked.
>
> My users controller now has an array that contains the id's of all the
> bookmarked images and I now want to get the data for the images that
> have been bookmarked but the "find" request has stumped me.
>
> class UsersController extends AppController {
>    var $name = 'Users';
>    var $uses = array('User','Image');
>    var $helpers = array('Html', 'Form');
>
>    function view($id=null){
>        $this->set('userdata', $this->User->findById($id));
>        $temp = $this->User->findById($id);
>        $bookmarklist = array();
>        foreach($temp['Bookmark'] as $bookmark){
>            $bookmarklist[] = $bookmark['image_id'];
>        }
>        $this->set('bookmarkdata', $this->Image->find(****ARGHHH, WHAT
> GOES HERE****));
>    }
> }
>
> I hope I've explained myself okay. Any help is greatly appreciated.
>
> Thanks,
>
> Dave.
> >
>


-- 
Anupom Syam
http://syamantics.com/

--~--~---------~--~----~------------~-------~--~----~
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