Catch last id inserted in mysql with php [duplicate]

-2

I have the following query of inclusion of registers

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

How do I not have to give a select in the last inserted data to get the generated id? because I already had problems with multiple users putting information into the system at the same time and returned wrong value.

    
asked by anonymous 06.09.2016 / 17:55

1 answer

-1

Although it's a duplicate post you get as follows

$idInserido=mysqli_insert_id($conexao);
    
06.09.2016 / 17:57