I should delete values from the database but end now, the only result that I managed to get is to make a certain value null, and then this then becomes invalid, but if I want to repeat the process I can no longer do it. My goal would be to freely delete all the products I want from a given event, place the code for deletion:
<a href="#elimina<?php echo $row['impianto_id_campagna']; ?>" data-toggle="modal" class="btn-floating btn-sm btn-pin "><span class="glyphicon glyphicon-trash"></span> <i class='fa fa-remove' aria-hidden='true'></i></a
modal:
<div class="modal fade" id="elimina<?php echo $row['impianto_id_campagna']; ?>" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header text-center">
<h4 class="modal-title w-100 font-weight-bold">Elimina Impianto</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<?php
$elimina=mysqli_query($connessione,"select * from campagne_cliente where impianto_id_campagna='".$row['impianto_id_campagna']."'");
$row_due=mysqli_fetch_array($elimina);
?>
<div class="modal-body mx-3">
<h5 style="text-align: center;">Eliminare l'impianto dalla campagna?</h5>
</div>
<div class="modal-footer d-flex justify-content-center">
<a href="eliminainfo.php?impianto_id_campagna=<?php echo $row['impianto_id_campagna']; ?>" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span>Elimina</a>
</div>
</div>
</div>
</div>
delete_page:
<?php
include '../../connessione.php';
$impianto_id_campagna=$_GET['impianto_id_campagna'];
mysqli_query($connessione,"UPDATE campagne_cliente SET impianto_id_campagna = NULL WHERE impianto_id_campagna = '$impianto_id_campagna'");
header('location: campagne.php');
?>
my db structure: my db structure
in the picture you will see a value set to 0, but if I later want to set another value to 0, I can not do it, the maximum would be to delete the whole row, starting from the id_impianto_campagna