你好我有3张桌子
属性(代理属性)
用户(代理商明细)
user_property (属性和用户表的联合表)
我尝试使用以下代码获取我的座席详情。
/* Fetch agent */
$agent = $this->user_m->get_agent($this->data['property_id']);
// [agent_direct feature]
$standard_agent = true;
if(config_db_item('agent_profile_direct') === TRUE)
{
$agent_direct = $this->session->userdata('agent_direct');
$last_activity = $this->session->userdata('last_activity');
if(is_array($agent_direct) && $agent_direct['id'] != $agent['id'])
{
$agent = $agent_direct;
$standard_agent=false;
}
}
// [/agent_direct feature]
if(count($agent))
{
$this->data['agent_name_surname'] = $agent['name_surname'];
$this->data['agent_phone'] = $agent['phone'];
$this->data['agent_mail'] = $agent['mail'];
$this->data['agent_address'] = $agent['address'];
$this->data['agent_id'] = $agent['id'];
$this->data['agent_name_title'] = url_title_cro($agent['name_surname']);
$this->data['agent_url'] = slug_url('profile/'.$agent['id'].'/'.$this->data['lang_code'].'/'.$this->data['agent_name_title']);
}
$this->data['has_agent'] = array();
if(count($agent))
$this->data['has_agent'][] = array('count'=>count($agent));
// Thumbnail
if(count($agent) && isset($agent['image_user_filename']))
{
$this->data['agent_image_url'] = base_url('files/thumbnail/'.$agent['image_user_filename']);
}
else
{
$this->data['agent_image_url'] = 'assets/img/user-agent.png';
}
但是当我尝试使用伪变量输出代理详细信息时,它什么都没有显示.. 只是一个空白的细节
这是我的代码
<div> {has_agent} <h2>{lang_Agent}</h2> <div class="agent"> <div class="image"><img src="{agent_image_url}" alt="{agent_name_surname}" /></div> <div class="name"><a href="{agent_url}#content">{agent_name_surname}</a></div> <div class="phone">{agent_phone}</div> <div class="mail"><a href="mailto:{agent_mail}?subject={lang_Estateinqueryfor}: {estate_data_id}, {page_title}">{agent_mail}</a></div> </div> {/has_agent} </div>
答案 0 :(得分:0)
从数据库表中获取数据的语法如下。
$this->db->get_where('tableName',array('columnName'=>'value'));
答案 1 :(得分:0)
总是尝试像这样使用。它非常好的编码和正确的编码风格。
$data['field_name'] = 'field_value';
$qry = $this->db->get_where('table_name',$data);
return $qry->result_array();