這是我的函數,其中i取我的結果從數據庫如何使用數組中的值獲取查詢的結果?
function Prof_Viewer($MemberId)
{
$query = $this->db->query("SELECT distinct(t1.dProfileId) as prof
FROM tbl_profile_viewer as t1
JOIN tbl_login as t2
WHERE t1.dProfileViwerId='$MemberId'");
if($query->num_rows > 0)
{
foreach($query->result() as $row)
{
echo $row->prof;//i am receiving many values here
$query1 = $this->db->query("SELECT distinct(t3.dUser_name),t2.dPath,t3.dCreatedDate
FROM tbl_login as t3
JOIN tbl_profile_viewer as t1,
tbl_member_details as t2
WHERE t3.dMember_Id = '$row->prof'
AND t2.dMember_Id ='$row->prof'");
}
return $query1->result_array();
}
}
正如上面評論我接收許多值,而回聲變量$行向>教授; 說我有值,如1 2和3 ....... 即使我有這三個值我'query1'
只取最後一個值。因此,我只有一個結果我希望查詢被執行1和2也 如何實現這一點