コード例 #1
0
if (isset($_POST['delete_subdestino'])) {
    $id = $_POST['delete_subdestino'];
    $destino = new Destinos();
    $conect = new Conectar();
    $sql = 'SELECT Foto 
           FROM lugares 
           WHERE Luga_Id =' . $id;
    $img = $conect->consultas($sql);
    if (isset($img[0])) {
        if (unlink('../img/' . $img[0])) {
            $data['img'] = "eliminado";
        } else {
            $data['img'] = "no eliminado";
        }
    }
    $data = $destino->delete_subdestino($id);
    echo json_encode($data);
}
//////////////////////////////////////////////////////////////////////////////////
if (isset($_POST['title'], $_POST['subtitulo'], $_POST['texto'], $_POST['id'])) {
    $conexion = new Conectar();
    $title = $_POST['title'];
    $subtitle = $_POST['subtitulo'];
    $texto = $_POST['texto'];
    $id = $_POST['id'];
    $sql = 'UPDATE lugares 
             SET Luga_title = "' . $title . '",
                 Luga_sub_title = "' . $subtitle . '",
                 Luga_descri = "' . $texto . '"
                 WHERE Luga_Id = ' . $id;
    $data = $conexion->update_query($sql);