Is there a mysqli equivalent to mysql_insert_id()

I do not fully understand this functions purpose. I think it’s supposed to return the last id from the inserted database entry.

This is being used in a function that handles three uploads at the click of a button. for ($i = 0; $i < $counter; $i++)

I am fairly new at PHP. Is there an equivalent to this function for mysqli (improved)? Or how would you suggest I accomplish this efficiently?


1 Like


Before I posted a question here I searched the PHP manual for mysql_insert_id(), but the search results came up zero.

Its there: (though I agree the search functionality on is a piece of trash);28)&lang=en

When searching for a function in the php manual, don’t include the (). So search for mysql_insert_id instead of mysql_insert_id().

And if you think’s search is bad, try the one on :smiley:

Personally I dont even use the search.
Type in
and you will get redirected to the manual page for that command, if it exists.

Off Topic:

What’s the bbcode to link to a PHP manual function page? I know you can use [ url=page]function but I seem to remember there’s a bbcode tag that will do this automatically

Off Topic:

I didn’t know that, but such a code does indeed extist: [fphp].

Example: [noparse][fphp]preg_match[/fphp][/noparse] => [fphp]preg_match[/fphp]

List of all available BB codes on SitePoint Forum:

Off Topic: