Welcome Guest, Not a member yet? Register   Sign In
Problem with Last inserted record id
#2

[eluser]Jilani Jidni[/eluser]
its happened because mysql last generated id is maintained in the server on a per-connection basis.


[quote author="Aniesh" date="1225184685"]Hello,

I have tested the '$this->db->insert_id();' function but it not returns the correct record id. I have tested the process with multiple insertion in a single query. The code is below:

Code:
class Mytest extends Controller
{

    function __construct()
    {
        parent::Controller();
    
        $this->load->database();
    }

    function index()
    {
        $query    =    "INSERT INTO `test` ( `id` , `name` ) VALUES ('', 'Reneesh'), ('', 'Shaiju')";

        $this->db->query($query);


        echo $this->db->insert_id();

    }
}

Please let me know your suggestions..

Thank You.[/quote]


Messages In This Thread
Problem with Last inserted record id - by El Forum - 10-27-2008, 10:04 PM
Problem with Last inserted record id - by El Forum - 10-28-2008, 12:12 AM
Problem with Last inserted record id - by El Forum - 10-28-2008, 12:19 AM
Problem with Last inserted record id - by El Forum - 10-28-2008, 12:39 AM
Problem with Last inserted record id - by El Forum - 10-28-2008, 01:18 AM



Theme © iAndrew 2016 - Forum software by © MyBB