douzhang7603 2015-03-21 23:18
浏览 20

如何在codeigniter中修复多连接

I have problem with my code. I finished the code, but when I uploaded it to hosting, I have a problem when I need get details by many tables using join.

For example in model:

function get_details($id)
{
    $this->db->select('*');
    $this->db->from('personal_info');
    $this->db->where('p_id', $id);
    $this->db->join('supply', 'supply.s_p_id = personal_info.p_id');
    $this->db->join('family_info', 'family_info.f_p_id = personal_info.p_id');
    $this->db->join('social_info', 'social_info.s_p_id = personal_info.p_id');
    $this->db->join('vote', 'vote.v_num = personal_info.std_type');
    /* have many more table join */
    $this->db->query('SET SQL_BIG_SELECTS=1'); 
    return $this->db->get();        

}

When calling it in controller and display values in view just loading and don't see any result just "blank page " but when using it in localhost, I get the values normally.

Ideas?

  • 写回答

1条回答 默认 最新

  • doujingjiao0015 2015-03-22 04:10
    关注

    You can echo the $this->db->last_query() in your local to get the executed query and test it.

    You also need to specify the join type as CodeIgniter documentation. e.g $this->db->join('supply', 'supply.s_p_id = personal_info.p_id', 'LEFT');

    if you need a specific type of JOIN you can specify it via the third parameter of the function. Options are: left, right, outer, inner, left outer, and right outer.

    I Believe this will solve the issue.

    评论

报告相同问题?

悬赏问题

  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100