return insert id from database insert function |
I have this function for insert data to database:
PHP Code: public function insertAlbumData(array $data) now, how to return insertID from this function?!
now, how to return insertID from this function?!
PHP Code: public function insertAlbumData(array $data)
You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.
Pass true as the second argument.
PHP Code: $id = $this->db->table('gallery_albums')->insert($data, true); Since there is overhead associated with getting the last inserted ID from many databases, you get a small performance boost by not returning it if you don't need it. So CI4 doesn't return that by default, but makes it easy to get it if you need it. |
Welcome Guest, Not a member yet? Register Sign In |