I'm pretty clumsy with the functions, and more with the use of return
.
I have this code:
public function addAuthor($autor, $nacimiento, $descripcion) {
$sql = $this->db->prepare("INSERT INTO autores (Autor, Nacimiento, Descripcion) VALUES (:autor, :nacimiento, :descripcion)");
$sql->execute(array(':autor'=>$autor, ':nacimiento'=>$nacimiento, ':descripcion'=>$descripcion));
$lastID = $this->db->lastInsertId('IDAutor');
return $lastID;
}
I need to use the $lastID
to be able to rename the photo with the id and then upload it.
this is the driver code:
$c->addAuthor($name, $nacimiento, $description);
How would I get the result of $lastID
? Should we call the function in another way? I am very lost with the issue of return
. I tried to read in the PHP
guide on the return
but I still do not see the form.