Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to a member function result_array() on a non-object in ... IS IT A BUG?
#1

[eluser]rochellecanale14[/eluser]
Hello guys, just want to ask about my code.
I always get the error "CALL TO A MEMBER FUNCTION RESULT_ARRAY()......"
I double checked my code and it seems to be ok. Here's my code I hope you can help me guys.

View
Code:
<?php $data_var = array('name'=>'category','id'=>'addForm'); ?>
<?php echo form_open('item_controller/delete_item',$data_var); ?>
....
....
....
<?php
         foreach($item as $row){
....
....
echo "<td>&lt;input type='button' value='EDIT' name='edit_item' data-value=".$row['itemid']."/&gt; &lt;input type='button' value='DELETE' name='delete_item' data-value=".$row['itemid']." /&gt;&lt;/td>";
....
....
....
<div id="edit"  none"></div>
....
....

$(".hero-unit input[name=edit_item]").on('click',function(){
            var category_id = $(this).attr('data-value');
            $('#edit').load("&lt;?php echo site_url("item_controller/editItemCategory/"); ?&gt;"+"/"+category_id).dialog({
                title: "Update Category",
                autoOpen: true,
                width: 450,
                modal:true,
                open: function (event, ui) { window.setTimeout(function () {
                    jQuery(document).unbind('mousedown.dialog-overlay').unbind('mouseup.dialog-overlay'); }, 100);
                }  
            })
});

Controller
Code:
public function editItemCategory(){
            
        $data['item'] = $this->item_model->displayItem($this->uri->segment(3));
        $data['displayItemcategory'] = $this->category_model->viewAllEntry();
        $this->load->view('User/header/header_user',$data);
        $this->load->view('Item/contents/editCategoryInfo');    

}
        
public function editItemNow(){
       $this->item_model->updateItemInfo();
       redirect('item_controller/index');
  }

Model
Code:
public function updateItemInfo(){
            $id = $this->input->post('cat_id');
            $name = $this->input->post('name');
            $desc = $this->input->post('description');
            
            $updateCat = array(
                'salescatname' => ucwords($name),
                'salescatdesc' => $desc
            );
            $this->db->where('salescatid',$id);
            $this->db->update('sales_category',$updateCat);
        }
        
        public function displayItem($id = 0){

           $sqlCategory = $this->db->query("SELECT * FROM item_category WHERE itemid = {$id}");
           return $sqlCategory->result_array(); //ERROR WHY?
        
        }
#2

[eluser]Cgull[/eluser]
Hi,

I don't see you call function displayItem anywhere, are you sure the error is coming from this line?




Theme © iAndrew 2016 - Forum software by © MyBB