How Do I Query A Table With Multiple Primary Key Values?

In the example below $subscribersResources returns all matched records for subscriber id 1, lets say 20 matches.

Now I want to use the id_resources field in $subscribersResources to query another table called resources.

$subscribersResources = SubscribersResources::model()->findAll("id_subscriber='1'");

$resources = Resources::model()->findAll(<img src='' class='bbc_emoticon' alt='???' />?<img src='' class='bbc_emoticon' alt='???' />?<img src='' class='bbc_emoticon' alt='???' />?);

I’m a beginner in case it isn’t obvious.

It can be:

$subscribersResources = SubscribersResources::model()->findAll("id_subscriber='1'");

$resources = Resources::model()->findAll('id=:id', array('id' => $subscribersResources->id_resources));

But I’d check

Thanks for the quick reply but yii logs and error: Trying to get property of non-object. If it helps this is the actual code.


     * @param string

     * @return string

     * @soap


  public function getResources($userInfo) {

  	    $response = array();

  		$userInfo = json_decode($userInfo, true);



			$response['error'] = 'Access denied';

			return json_encode($response);

  	    } else {

			$subscriber = Subscribers::model()->find("username='" . $this->getUserIdFromKey($userInfo['authKey']) . "'");

			$subscriberResources = SubscribersResources::model()->findAll("id_subscriber='" . $subscriber->id . "'");

			$resources = Resources::model()->findAll('id=:id', array('id' => $subscriberResources->id_resource));

			return json_encode($resources);