I am trying to get the next number in a column called TARIMA
, the problem is that% is not% co_ since it is apart from autoincremento
general ID
, try to use AI
to get the next lastinsertid
of the table but it does not return anything.
$rs = mysqli_query($con,"SELECT MAX(tarima) FROM tarima_detalles");
if ($row = mysqli_fetch_row($rs)) {
$codigo = trim($row[0]);
if(mysqli_query($con,"INSERT INTO tarima_detalles (TARIMA, SEPARACION, Cajas, Peso,calidad) VALUES ('$codigo','$separacion','$cajas','$peso','$calidad')")){
echo(mysqli_insert_id($con));
}else{
echo("Error description: " . mysqli_error($con));
}
mysqli_close($con);
}else{
echo "ERROR";
It only repeats data to me, except if it was empty it does not insert anything .: