本文整理汇总了PHP中CI_Model::get_info方法的典型用法代码示例。如果您正苦于以下问题:PHP CI_Model::get_info方法的具体用法?PHP CI_Model::get_info怎么用?PHP CI_Model::get_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CI_Model
的用法示例。
在下文中一共展示了CI_Model::get_info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function get_info_customer($customer_id)
{
$this->db->from('employees');
$this->db->join('people', 'people.person_id = employees.person_id');
// $this->db->join('app_files', 'people.image_id = app_files.file_id');
$this->db->where('employees.person_id',$customer_id);
$query = $this->db->get();
if($query->num_rows()==1)
{
return $query->row();
}
else
{
//Get empty base parent object, as $customer_id is NOT an customer
$person_obj=parent::get_info(-1);
//Get all the fields from customer table
$fields = $this->db->list_fields('employees');
//append those fields to base parent object, we we have a complete empty object
foreach ($fields as $field)
{
$person_obj->$field='';
}
return $person_obj;
}
}
示例2: foreach
function get_info($user_id)
{
$this->db->from('user');
$this->db->where('user_id', $user_id);
$query = $this->db->get();
if ($query->num_rows() == 1) {
return $query->row();
} else {
//Get empty base parent object, as $employee_id is NOT an employee
$person_obj = parent::get_info(-1);
//Get all the fields from employee table
$fields = $this->db->list_fields('user_name');
//append those fields to base parent object, we we have a complete empty object
foreach ($fields as $field) {
$person_obj->{$field} = '';
}
return $person_obj;
}
}
示例3: foreach
function get_info($supplier_id)
{
$this->db->from('suppliers');
$this->db->join('people', 'people.person_id = suppliers.person_id');
$this->db->where('suppliers.person_id', $supplier_id);
$query = $this->db->get();
if ($query->num_rows() == 1) {
return $query->row();
} else {
//Get empty base parent object, as $supplier_id is NOT an supplier
$person_obj = parent::get_info(-1);
//Get all the fields from supplier table
$fields = $this->db->list_fields('suppliers');
//append those fields to base parent object, we we have a complete empty object
foreach ($fields as $field) {
$person_obj->{$field} = '';
}
return $person_obj;
}
}