kissmumu 发表于 2008-11-6 14:35:46

你的资料库是?
可以prime key为空?

kfrico 发表于 2008-11-6 14:58:12

postgresql

prime key沒有為空
我的意思是指PersonID表格填入查尋時為空就以or_where其他條件做判斷

終於找到問題了
postgresql資料庫有分大小寫
$this->db->join("AssocChairMan", '"AssocChairMan"."PersonID" = "PersonMaster"."PersonID"');

[ 本帖最后由 kfrico 于 2008-11-6 15:14 编辑 ]

kissmumu 发表于 2008-11-6 15:15:04

我是这样用的      $this->db->select('hr.id, hr.position, hr.date, company.companyname');
      $this->db->from('hr');
      $this->db->join('company', 'company.id=hr.cid', 'left');
      $this->db->limit(20);
      $data['position_list']                   = $this->db->get();
      
      $this->db->select('resume.id, person.truename, person.sex, resume.xueli, resume.zhuanye, resume.date');
      $this->db->from('resume');
      $this->db->join('person', 'resume.pid=person.id', 'left');
      $this->db->limit(20);
      $data['person_list']                     =$this->db->get();
view:        <?php
        foreach ($person_list->result() as $row) :
        ?>
<tr>
    <td align="left"><?php echo $row->truename ?></td>
    <td align="left"><?php echo $row->sex?'男':'女'; ?></td>
    <td align="left"><?php echo $row->xueli ?></td>
    <td align="left"><?php echo $row->zhuanye ?></td>
    <td align="left"><?php echo $row->date ?></td>
</tr>
<?php
   endforeach;
?>
希望对你有帮助

xjflyttp 发表于 2008-11-14 09:38:10

foreach($data->result_array() as $row){
    echo '<TD align=left>';
    echo$row->PersonID;
    echo'</TD>';
    echo '<TD align=left>';
    echo$row->ChineseName;
    echo'</TD>';
    echo '<TD align=left>';
    echo$row->Sex;
    echo'</TD>';
    echo '<TD align=left>';
    echo$row->Status;
    echo'</TD>';
}
页: 1 [2]
查看完整版本: JOIN用法有錯嗎