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?

Thanks.

http://www.php.net/manual/en/mysqli.insert-id.php
http://dev.mysql.com/doc/refman/5.0/en/mysql-insert-id.html

1 Like

Thanks.

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 php.net is a piece of trash)

http://www.php.net/manual-lookup.php?pattern=mysql_insert_id&#37;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 php.net’s search is bad, try the one on dev.mysql.com :smiley:

Personally I dont even use the search.
Type in php.net/command_name_here
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: http://www.sitepoint.com/forums/misc.php?do=bbcode

Off Topic:

:magic: