【发布时间】:2014-08-30 11:00:21
【问题描述】:
我的模特:
public function category($cat)
{
$this->db->select('c.id, c.cat2, c.category, m.id, m.date, m.when_date, m.when_time, m.where_m');
$this->db->from('category c');
$this->db->where('c.category', '$cat');
$this->db->join('meeting m', 'm.id_cat = c.id');
$result = $this->db->get();
return $result->result();
}
我的控制器:
$data['meeting'] = $this->users_m->category($cat);
$this->load->view('category', $data);
我的看法:
<table>
<?php foreach($meeting as $row): ?>
<tr>
<td><?php echo ($row->id); ?> </td>
<td><?php echo ($row->id_cat); ?> </td>
<td><?php echo ($row->date); ?> </td>
<td><?php echo ($row->when_date); ?> </td>
<td><?php echo ($row->where_m); ?></td>
</tr>
<?php endforeach; ?>
</table>
当我尝试回显这些数据时,什么也没发生;没有错误信息。任何想法?我是新手。
【问题讨论】:
-
使用
$this->db->last_query()查找正在执行的sql查询... -
解析错误:语法错误,第 23 行 C:\xampp\htdocs\ci\application\models\users_m.php 中的意外“返回”(T_RETURN)
-
哪一行不是23?
标签: php mysql codeigniter join html-table