我想知道如何修复这些错误消息?
遇到PHP错误 严重程度:通知 消息:尝试获取非对象的属性。 文件名:视图/画廊_pictures.php 线路号码: 69
模型/Mpages.php
public function add_picture_gallery($filename, $gallery_id)
{
$data = array(
'galleryies_id' => $gallery_id,
'galleries_picture_name' => $filename,
);
$query = $this->db->insert('galleries_pictures', $data);
return $query->result();
} HTML
<tr>
<td><img src="<?php echo base_url();?>uploads/<?php echo $pictures_item->galleries_picture_name; ?>" height="200" width="300"></td>
<td><?php echo $pictures_item->galleries_picture_name; ?></td>
<td><button type="button" class="edit">EDIT</button></td>
<td><button type="button" class="delete">DELETE</button></td>
</tr>发布于 2016-11-18 10:24:48
首先,您需要select。不是insert
这边试试.
在控制器中
$data['image_list'] = $this->ur_Model->get_image_list();
$this->load->view('ur_view_filename', $data);in模型
public function get_image_list()
{
$this->db->select('*');
$this->db->from('ur_table');
return $this->db->get();
}观照
<table>
<?php foreach ($image_list->result() as $pictures_item) { ?>
<tr>
<td><img src="<?php echo base_url();?>uploads/<?php echo $pictures_item->galleries_picture_name; ?>" height="200" width="300"></td>
<td><?php echo $pictures_item->galleries_picture_name; ?></td>
<td><button type="button" class="edit">EDIT</button></td>
<td><button type="button" class="delete">DELETE</button></td>
</tr>
<?php } ?>
</table>https://stackoverflow.com/questions/40670555
复制相似问题