Welcome Guest, Not a member yet? Register   Sign In
Nesting queries within active record
#17

[eluser]Sumon[/eluser]
have a look the following code. may be helpful to understand
Controller :
Code:
$Data['Recordsets'] = $this->model_name->MemberProfile($MemberId);
$this->load->view("member/view_all_member_info",$Data);
Model : (model_name.php)
Code:
function MemberProfile($MemberId)
    {
    $query = $this->db->query("SELECT Com.*, Login.mem_id, Login.mem_primary_photo, Profile.mem_first_name, Profile.mem_last_name FROM image_gallery_image_comment Com, member_login Login, member_profile Profile WHERE Com.image_id='$PhotoId' AND Com.mem_id=Login.mem_id AND Profile.member_id=Login.mem_id");
    if ($query->num_rows() > 0)
    {
            $i=0;
            foreach($query->result() as $val):
                foreach($val as $Key=>$Value):
                                  if($Key=="mem_primary_photo") //for example this is your car model(Ford)
                                     $MemberPhoto[$i] = $Value;
                                  else
                                     $AllInfo[$i][$Key]=$Value;
                endforeach;
                $i++;
            endforeach;
            return $Comments;
        }
        else
            return FALSE;
    }
View : (view_all_member_info.php)
Code:
if(count($Recordsets->result())==0)    echo "Sorry no member exists.";
    <?php foreach($Recordsets->result() as $row): ?>
        <?=$row->site_feature_name;?>
    <?php endforeach; ?>


Messages In This Thread
Nesting queries within active record - by El Forum - 10-03-2008, 07:41 PM
Nesting queries within active record - by El Forum - 10-04-2008, 04:26 AM
Nesting queries within active record - by El Forum - 10-04-2008, 05:09 AM
Nesting queries within active record - by El Forum - 10-04-2008, 07:24 AM
Nesting queries within active record - by El Forum - 10-04-2008, 07:25 AM
Nesting queries within active record - by El Forum - 10-04-2008, 09:52 AM
Nesting queries within active record - by El Forum - 10-04-2008, 10:15 AM
Nesting queries within active record - by El Forum - 10-04-2008, 10:36 AM
Nesting queries within active record - by El Forum - 10-04-2008, 11:49 AM
Nesting queries within active record - by El Forum - 10-05-2008, 06:29 PM
Nesting queries within active record - by El Forum - 10-05-2008, 10:27 PM
Nesting queries within active record - by El Forum - 10-05-2008, 10:34 PM
Nesting queries within active record - by El Forum - 10-05-2008, 10:45 PM
Nesting queries within active record - by El Forum - 10-05-2008, 10:46 PM
Nesting queries within active record - by El Forum - 10-05-2008, 11:29 PM
Nesting queries within active record - by El Forum - 10-05-2008, 11:46 PM
Nesting queries within active record - by El Forum - 10-06-2008, 12:55 AM
Nesting queries within active record - by El Forum - 10-06-2008, 01:02 AM
Nesting queries within active record - by El Forum - 10-06-2008, 01:04 AM
Nesting queries within active record - by El Forum - 10-06-2008, 01:08 AM



Theme © iAndrew 2016 - Forum software by © MyBB