Welcome Guest, Not a member yet? Register   Sign In
Can't insert new record to MySQL Database
#3

[eluser]Unknown[/eluser]
I already copy both of your code and
this is the error
Model
Code:
A PHP Error was encountered

Severity: Notice

Message: Undefined property: CI_Loader::$input

Filename: models/test_model.php

Line Number: 10

Fatal error: Call to a member function post() on a non-object in /home/pgmr4/public_html/testInsert/application/models/test_model.php on line 10

and I try to solve it by change the code like this

Code:
<?php
    if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    
    class Test_model extends CI_Model{
        public function insert(){
            $this->load->helper('url');
            
            $data = array('id' => $this->input->post('id'),
                  'deskripsi' => $this->input->post('deskripsi')
            );

            return $this->db->insert('table_name', $data);
        }
    }
?>

and still no data in my database

regards


Messages In This Thread
Can't insert new record to MySQL Database - by El Forum - 07-03-2013, 09:59 PM
Can't insert new record to MySQL Database - by El Forum - 07-03-2013, 11:39 PM
Can't insert new record to MySQL Database - by El Forum - 07-04-2013, 12:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB