Welcome Guest, Not a member yet? Register   Sign In
mysqli $this->db->insert_id constantly returns 0

Hi everyone i have been using codeigniter for 8 years now...

i am having an issue when switching from the mysql driver to the mysqli driver from the application/config/database.php

when i switch to mysqli $this->db->insert_id constantly returns 0... when i was using the old mysql driver it was working fine... i cant find anyone else with the same issue... i had the same issue with codeigniter 2.x... my pconnect is set to true... even when i set my pconnect is set to false i get the same result...

i do a standard:

$this->db->insert('gallery_gal', $data);
$this->db->insert_id(); // returns 0 every time

the id value is set as auto_increment on the gallery_gal table with the id field called "id_gal"

Can someone please help me with this...

here is my db configuration

$db['default'] = array(
'dsn' => '',
'hostname' => 'localhost',
'username' => 'root',
'password' => '',
'database' => 'buzzdb',
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => TRUE,
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE

Thanks in advance...

Messages In This Thread
mysqli $this->db->insert_id constantly returns 0 - by andros - 05-28-2015, 12:19 AM

Theme © iAndrew 2016 - Forum software by © MyBB