get all the user id's for each user id get the relationship question for each user id get the match_sex question you will need to merge the two objects as array if you want them to be together otherwise you will need to access them seperately. I put the output and exit after the first user so you can see the formats of the objects without having to do the whole user base. //testing begin $userlist = BOL_UserDao::getInstance()->findAll(); foreach($userlist as $user) { $uid = (int) $user->id; $example = new OW_Example(); $example->setOrder('userId ASC'); $example->andFieldEqual('questionName', "relationship"); $example->andFieldEqual('userId', $uid); $relationship[] = BOL_QuestionDataDao::getInstance()->findListByExample($example); $example = new OW_Example(); $example->setOrder('userId ASC'); $example->andFieldEqual('questionName', "match_sex"); $example->andFieldEqual('userId', $uid); $matchsex[] = BOL_QuestionDataDao::getInstance()->findListByExample($example); //output for test 1st user only echo "
";
print_r($relationship);
echo "
"; print_r($matchsex); exit; }//close foreach //testing end