I have the following product table
idproducto
numero_orden
modelo
tipo
fecha
fecha2
status
resultado
the "date" is which the product is registered and "date2" is when the product is delivered or modified, the problem is that when registering a product is shown in the field of "last update" 0000-00- 00 00:00:00 this is my code to register the product
$consulta = mysqli_query($connect, "SELECT * FROM producto ORDER BY idproducto DESC LIMIT 1")
or die ("Error al traer los datos");
$idproducto=1000;
while ($extraido = mysqli_fetch_array($consulta)) {
$idproducto = $extraido['idproducto'] + 1;
}
$num_orden= $_POST['num_orden'];
$modelo= $_POST['modelo'];
$tipo= $_POST['tipo'];
date_default_timezone_set('America/La_Paz');
$fecha= date("Y-m-d H:i:s");
$estatus = $_POST['status'];
$query = mysqli_query($connect, "INSERT INTO producto(idproducto, num_orden, modelo, tipo, fecha, status)
VALUES ('$idproducto','$num_orden', '$modelo', '$tipo', '$fecha','$estatus')")
or die ("Error al registrar producto");
In my code to show the fields is this
<tr>
<td style="text-align:center;"><?php echo $data['idproducto']; ?></td>
<td style="text-align:center;"><?php echo $data['num_orden']; ?></td>
<td style="text-align:center;"><?php echo $data['modelo']; ?></td>
<td style="text-align:center;"><?php echo $data['tipo']; ?></td>
<td style="text-align:center;"><?php echo $data['fecha']; ?></td>
<td style="text-align:center;"><?php echo $data['fecha2']; ?></td>
<td style="text-align:center;"><?php
switch ($data['status']) {
case "En espera":
echo "En espera";
break;
case "En proceso":
echo "En proceso";
break;
case "En proceso con demora":
echo "En proceso con demora";
break;
case "Finalizado":
echo "Finalizado";
break;
case "Finalizado sin reparar":
echo "Finalizado sin reparar";
break;
}
?>
</td>
<td style="text-align:center;"><?php echo $data['resultado'];
?></td>
<td>
So how can I make it so that it only shows the value of date2 only when it is modified there?