I'm doing a project that is in the following form:
First the person will upload the photo of her in the bd (Table: registered, field: photo) But in this table there are other fields, so I created a form that will change the last line and add the other fields (name, phone, email, etc.) while holding the photo.
The problem is: UPDATE cadastro SET nome = $nome WHERE id = **PROBLEMA**;
I need the ID to be the last one I recorded the photo, but I do not know how to get it.
To better interpret my question :
Thisisthetable,andthefieldsofitMysql.Ialreadyrecordedthephotoasyoucansee.NowontheformIwanttogiveanUPDATEtoappendtheremaininginformationonthatlinethere(id=20)eg.
IMAGEINSERTCODE:
functionsaveimagem($name,$image){$host="localhost";
$user = "root";
$pass = "";
$conexao = mysqli_connect($host, $user, $pass) or die (mysql_error());
mysqli_select_db($conexao, "teste");
$sql = "insert into cadastro (foto) values ('$image')";
if($sql){
print "ID: ". mysqli_insert_id($conexao);
}
$result = mysqli_query($conexao, $sql);
if($result)
{
echo "<br/>Foi feito o upload";
}else
{
echo "<br/>Não foi feito o upload";
}
}