public function task_delete() { global $dbh; $id = isset($_GET['id']) ? (int) $_GET['id'] : null; if (!$id) { SB_MessagesStack::AddMessage('Identificador de imagen invalido.', 'error'); return false; } $query = "DELETE FROM contenido WHERE id = {$id} LIMIT 1"; $dbh->query($query); SB_MessagesStack::AddMessage('Imagen borrada', 'success'); header('Location: index.php?mod=images'); }
$the_image = null; if ($vid) { $query = "SELECT * FROM contenido WHERE id = {$vid} LIMIT 1"; $res = $dbh->query($query); $the_image = $res->fetch_object(); $title = 'Editar Imagen'; } $query = "SELECT * FROM categoria ORDER BY categoria ASC"; $res = $dbh->query($query); ?> <h1 id="title"><?php print $title; ?> </h1> <?php print SB_MessagesStack::ShowMessages(); ?> <form action="" method="post" enctype="multipart/form-data"> <input type="hidden" name="task" value="save" /> <input type="hidden" name="mod" value="<?php print $_mod; ?> " /> <?php if (isset($_GET['id'])) { ?> <input type="hidden" name="id" value="<?php print (int) $_GET['id']; ?> " /> <?php
public function task_delete() { global $dbh; $video_id = isset($_GET['id']) ? (int) $_GET['id'] : null; if (!$video_id) { return false; } $query = "SELECT * FROM contenido WHERe id = {$video_id} LIMIT 1"; $row = $dbh->query($query)->fetch_object(); //##delete image if (!empty($row->imagen)) { @unlink(BASEPATH . '/imagen/archivos/' . $row->imagen); } $query = "DELETE FROM contenido WHERE id = {$video_id} LIMIT 1"; $dbh->query($query); SB_MessagesStack::AddMessage('El video fue borrado.', 'success'); header('Location: index.php?mod=videos'); }