Welcome Guest, Not a member yet? Register   Sign In
insertID()
#1

Hello,

Getting the following exception back when using the insertID() function.

Quote:Call to undefined method CodeIgniter\Database\MySQLi\Builder::insertID()

Don't know if i'm using it the wrong way but the following line is used inside my Model.

PHP Code:
protected $table 'Clients';

public function 
__construct()
{
 
     $this->managers = \Config\Database::connect()->table($this->table);

Reply
#2

I think, there is no insertId() in Builder. You should use $db->insertId();
Tafsir NU adalah sebuah aplikasi yang berisi kumpulan kajian kitab kuning yang disampaikan oleh Kiai Nahdhotul Ulama seperti Gus Baha, gus mus, dan kiai lainnya dalam format audio.
Reply
#3

(This post was last modified: 11-19-2016, 06:04 PM by superior.)

(11-19-2016, 05:19 PM)ridho Wrote: I think, there is no insertId() in Builder. You should use $db->insertId();

Getting identical exception when setting it as you purposed.

Also please take a look at the following file:   "system\Database\MySQLi\Connection.php" on line "465" you can see it's "public function insertID() { ... }"

Got this information from the following documentation page: $db->insertID();
Reply
#4

Try this, it's working for me

PHP Code:
protected $table 'Clients';

public function 
__construct()
{
      
$this->dbConn = \Config\Database::connect();
      
$this->managers $this->dbConn->table($this->table);

public function 
insertSomething(){
    
//your insert code
    
return $this->dbConn->insertID();

Tafsir NU adalah sebuah aplikasi yang berisi kumpulan kajian kitab kuning yang disampaikan oleh Kiai Nahdhotul Ulama seperti Gus Baha, gus mus, dan kiai lainnya dalam format audio.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB