I have the following script to delete selected items from a table.
<?php
class deleteNews extends Generic
{
private $error;
private $news_id_delete;
function __construct()
{
if (empty($_POST['deleteCheck'])) {
echo '<div class="alert alert-danger" role="alert"> <strong>Erro!</strong> Nenhuma notícia foi selecionada! </div>';
}
if(isset($_POST['deleteCheck'])) {
$this->news_id_delete = parent::secure($_POST['deleteCheck']);
$params = array(
':news_id_delete' => $this->news_id_delete,
);
foreach($this->news_id_delete as $delete) {
$sql = "DELETE FROM `login_news` WHERE `news_id` = $delete;";
parent::query($sql, $params);
}
echo '<div class="alert alert-success" role="alert"> <strong>Sucesso!</strong> Sua notícia foi publicada! </div>';
}
}
}
if (isset($_POST['deleteBtn'])) {
$addUser = new deleteNews();
}
?>
It works fine, the problem is that each time it executes, it returns the following Notice:
Notice: Array to string conversion
How can I get rid of this notice?