can't make mysqli_insert_id work..
The id is AUTO_INCREMENT
but still doesn't work.
$query = "INSERT INTO categoriasdivisiones (titulo, orden, descripcion, id_familiadivisiones) VALUES ('$titulo','$orden', '$descripcion', '$id_familia');";
mysqli_query($base, $query);
$ultimo_id = mysqli_insert_id($base);
Here i call the database:
include('../../../php/config.php');
the route is ok.
I know the problem in the code is the insert_id function because i have an image where i use this path:
move_uploaded_file($foto['tmp_name'], '../../../imagenes/categoriadivisiones/catdivisiones_'.$ultimo_id.'.'.$extensionfoto.'');
And the image is being saved as = catdivisiones_0.png
Hope you can help me.
CREATE TABLE `categoriasdivisiones` (
`id` int(11) NOT NULL,
`titulo` text NOT NULL,
`descripcion` text NOT NULL,
`imagen` text NOT NULL,
`orden` text NOT NULL,
`id_familiadivisiones` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `categoriasdivisiones`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;