Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to a member function on a non-object
#1

[eluser]Gwarrior[/eluser]
I'm fairly new to CI, but using the MVC approach, I keep getting this error.

Fatal error: Call to a member function on a non-object

In which it is referring to the Model below.

Code:
function insert_item() {
         $this->load->database();
        $itemname = $this->input->post('itemname');
        $price = $this->input->post('price');
        $details = $this->input->post('details');
        $paypal = $this->input->post('paypal');
        $image = $this->input->post('image');
        $query = $this->db->query("INSERT INTO products (itemname, price, details, paypal, image) VALUES ('$itemname', '$price', '$details', '$paypal', '$image')");
        if ($query->num_rows() > 0) {
            echo 'Item Added to the Catelog.';
        } else {
            echo 'Item NOT Added to the Catelog.';
        }
    }

The specific line is
Code:
if ($query->num_rows() > 0) {

Anyone know why? Thanks!


Messages In This Thread
Fatal error: Call to a member function on a non-object - by El Forum - 10-14-2008, 06:09 PM
Fatal error: Call to a member function on a non-object - by El Forum - 10-15-2008, 03:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB