ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

mysql insert id doesn't work

April 15, 2013 11:36pm

Subscribe [2]
  • #1 / Apr 15, 2013 11:36pm

    tperrelli

    3 posts

    Hello fellows…

    I activated the active record and i tried to use:

    $id = $this->db->insert_id();
    //or
     $id = mysql_insert_id();

    but those code simply don’t work.
    i’ve tried to change

    $db['default']['dbdriver'] = 'mysql';
    //to
    $db['default']['dbdriver'] = 'mysqli';

    but it stills returning 0 (zero) in the insert id function.
    what would i do?

     

  • #2 / Jul 21, 2013 4:48am

    Katie1348

    7 posts

    Hi tperrelli,

    I don’t think you are using the insert_id method correctly.

    http://ellislab.com/codeigniter/user-guide/database/helpers.html

    The insert ID number when performing database inserts.

    The insert_id method or function is used to get the ID of the last insert.

    Regards,

    Kate

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases