Get last id inserted in mysql with php

Asked

Viewed 1,475 times

-1

I have the following listing query

mysqli_query($conexao,"INSERT into cadastro set nome='$nome',telefone='$fone',cep='$cep',secao='$categoria'");

how do I not have to select the last input to get the generated id? because I’ve had problems with multiple users putting information in the system at the same time and returned wrong value.

1 answer

2


despite being a duplicate post you picked up as follows

$idInserido=mysqli_insert_id($conexao);
  • Aff to negative the answer?

  • I thought the answer was good. I just needed to complement a little bit with the query, etc.. I could have used the code of the question. The people here mark up. But won my upvote to neutralize. ;D

Browser other questions tagged

You are not signed in. Login or sign up in order to post.