Note that there are some explanatory texts on larger screens.

plurals
  1. POI can not delete records from the database
    text
    copied!<p>I can not delete records from the database. In the page that I am creating, a user can delete the news that creates, when a user presses the button "delete", the system redirects to a file called "borrar_noticia.php". This archive take the variable utc by a "GET" and then makes the query to the database.</p> <p>Here I leave the file showing news that makes a user:</p> <pre><code> &lt;?php require('mysql.php'); $query = mysql_query("SELECT * FROM post WHERE usuario ='".$_SESSION['usuario_t']."' ORDER BY utc DESC;"); while($fila = mysql_fetch_array($query)){ echo " &lt;article&gt; &lt;div id='logov2b' style='background:url(\"photo/".$fila['icono'].".jpg\");'&gt;&lt;/div&gt; &lt;time&gt;".$fila['ano']."-".$fila['mes']."-".$fila['dia']."&lt;/time&gt; &lt;h3&gt;".$fila['titulo']."&lt;/h3&gt; &lt;h4&gt;".$fila['subtitulo']."&lt;/h4&gt; &lt;p&gt;".$fila['texto']."&lt;/p&gt; &lt;a href='includes/eliminar_post.php?id=".$fila['utc']."'&gt;Eliminar&lt;/a&gt; - Editar &lt;/article&gt; "; } mysql_close($db_link); ?&gt; </code></pre> <p>This is the file that queries the database:</p> <pre><code>&lt;?php require('mysql.php'); $id = $_GET['utc']; mysql_query("DELETE FROM post WHERE utc= '".$id."' LIMIT 1"); header("location:../index.php"); ?&gt; </code></pre> <p>This is the file that connecting the database:</p> <pre><code>&lt;?php $db_link = mysql_connect('127.0.0.1', 'root', ''); if(!$db_link){ die('No se pudo conectar: ' . mysql_error()); } $db_selected = mysql_select_db('blog',$db_link); if(!$db_selected){ die('No se selecciono la BD: ' . mysql_error()); } ?&gt; </code></pre> <p>What did I do wrong, and how can I fix the problem? </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload