[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]