[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!