Skip to content

Instantly share code, notes, and snippets.

@TiuTalk
Created February 20, 2015 02:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TiuTalk/b2349ad5a771c133a253 to your computer and use it in GitHub Desktop.
Save TiuTalk/b2349ad5a771c133a253 to your computer and use it in GitHub Desktop.
<?php
// Inclui o arquivo que faz a conexão ao MySQL
include("conexao.php");
// Montamos a consulta SQL para deletar a(s) notícia(s) com ID maior ou igual a três
$query = "DELETE FROM `noticias` WHERE (`id` >= 3)";
// Executa a query
$deletar = mysql_query($query);
if ($deletar) {
echo "As notícias foram deletadas com sucesso!";
} else {
echo "Não foi possível deletar as notícia, tente novamente.";
// Exibe dados sobre o erro:
echo "Dados sobre o erro:" . mysql_error();
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment