I have this code.compiler doesn't enter in foreach. I don't know why? although i write this foreach in other function and works,please any one help me.
in model
public function getting_profile_check($u)
{
$this->db->where('login_name', $u);
return $this->db->get('profile_check');
}
and in controller
public function get_profile_check($user)
{
echo"i in get profile check";
$d=$this->login_m->getting_profile_check($user);
$data=array('check_res'=>$d,'first_time'=>"no");
foreach($d->result() as $field)
{
echo"i in for each in get";
$image=$field->image_c;
$view=$field->overview_c;
$certi=$field->certi_c;
$edu=$field->edu_c;
$hopp=$field->hopp_c;
$lang=$field->lang_c;
echo"session".$image." " .$edu;
}
}
Try this
In Controller
public function get_profile_check($user)
{
echo"i in get profile check";
$d = $this->login_m->getting_profile_check($user);
$data=array('check_res'=>$d,'first_time'=>"no");
foreach($d as $field)
{
echo"i in for each in get";
$image=$field->image_c;
$view=$field->overview_c;
$certi=$field->certi_c;
$edu=$field->edu_c;
$hopp=$field->hopp_c;
$lang=$field->lang_c;
echo"session".$image." " .$edu;
}
}
In Model
public function getting_profile_check($u)
{
$this->db->select("*");
$this->db->where('login_name', $u);
$query = $this->db->get('profile_check');
$result = $query->result_array();
return $result;
}
do something like this in model:
public function getting_profile_check($u)
{
$this->db->select('*')
->from('profile_check')
->where('login_name', $u);
$query = $this->db->get();
if($query->num_rows > 0){
return $query->result_array();
}
}
in controller:
public function get_profile_check($user)
{
echo"i in get profile check";
$d=$this->login_m->getting_profile_check($user);
foreach ($d as $row ) {
echo $row['name_of_table_column'];
}
}
Model
public function getting_profile_check($u)
{
$this->db->where('login_name', $u);
return $this->db->get('profile_check')->result();
}
Controller
public function get_profile_check($user)
{
echo"i in get profile check";
$d=$this->login_m->getting_profile_check($user);
foreach ($d as $row )
{
echo $row->name_of_table_column;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.