php - Using mysqli_multi_query and keeping database link open -
i using procedural version of mysqli_multi_query() in several instances in script. everytime use function, destroys connection acquired mysqli_connect().
this wrecking havoc mysqli_insert_id()
is there way can avoid mysqli_multi_query destroying db link? if not, there alternative breaking queries? there way pass comma delimited multiple queries?
it's not destroying db link, if you're doing multiple inserts single multi_query call, you're getting expected behavior... insert_id() shorthand way of doing
select last_insert_id(); which return id of last executed insert on connection. if you're doing multiple isnerts in single call, you'll lose ids of last 1 performed.
so answer is: don't use multi_query() if you're doing multiple inserts , need capture new ids.
Comments
Post a Comment