Does not delete the record in my BD that I select

0

This is my query module, where I have the options to modify and delete , the problem I have is that when I click on the delete button only the message of the script "REGISTRATION ELIMINATED "But it does not really delete the data from my BD.

Thanks / Regards.

        <?php

				require("connect_db.php");
				$sql=("SELECT * FROM ctg_turno");
	
                //la variable  $mysqli viene de connect_db que lo traigo con el require("connect_db.php");
				$query=mysqli_query($mysqli,$sql);

				echo "<table border='1'; class='table table-hover';>";
					echo "<tr class='warning'>";
					    echo "<td>ID</td>";
						echo "<td>Turno</td>";
						echo "<td>Horas por Jornada</td>";
						echo "<td>Actualizar</td>";
						echo "<td>Eliminar</td>";
					      echo "</tr>";

			    
			?>
			  
		<?php 
				 while($arreglo=mysqli_fetch_array($query)){
				  	echo "<tr class='success'>";
				    	echo "<td>$arreglo[0]</td>";
					echo "<td>$arreglo[1]</td>";
				    	echo "<td>$arreglo[2]</td>";
						
                        echo "<td><a href='actualizar_turno.php?idctg_turno=$arreglo[0]'><img src='images/actualizar.gif' class='img-rounded'></td>";
		        echo "<td><a href='turno_edit.php?idctg_turno=$arreglo[0]'><img src='images/eliminar.png' class='img-rounded'/></a></td>";
						

						
					echo "</tr>";
				}
				

				echo "</table>";
  
                                 extract($_GET);
					if(@$idctg_turno){
		
						$sqlborrar="DELETE FROM ctg_turno WHERE idctg_turno=$idctg_turno";
						$resborrar=mysqli_query($mysqli,$sqlborrar);
						echo '<script>alert("REGISTRO ELIMINADO")</script> ';				
						echo "<script>location.href='turno_edit.php'</script>";
					}
					

			?>
    
asked by Carlos 23.03.2018 в 22:36
source

1 answer

0

The function you are using, mysqli_query , returns FALSE in the event of a statement error. do not you control this, and on the other hand you print $ sqlborrar on screen?

You can also print the latest mysqli error if it helps you out.

At first glance, I do not see the problem (mainly because you say that the alert comes up, so it's running), to see if my advice will help you.

    
answered by 23.03.2018 / 22:49
source