Ejemplo n.º 1
0
             SET Luga_title = "' . $title . '",
                 Luga_sub_title = "' . $subtitle . '",
                 Luga_descri = "' . $texto . '"
                 WHERE Luga_Id = ' . $id;
    $data = $conexion->update_query($sql);
    echo json_encode($data);
}
///////////////////////////////////////////////////////////////////////////////////
// inserta nuevos registros cuando un administrador añade nuevos subdestinos en la editacion
if (isset($_POST['title_new'], $_POST['subti_new'], $_POST['text_new'], $_POST['id'], $_FILES['foto'])) {
    // $foto;
    $lugar = new Lugares();
    $id = $_POST['id'];
    $title = $_POST['title_new'];
    $subtitle = $_POST['subti_new'];
    $descrip = $_POST['text_new'];
    $files = $_FILES['foto'];
    $cont_caract = strlen($files['name']);
    if ($cont_caract > 40) {
        $nomb = substr($files['name'], 0, 35);
    } else {
        $nomb = $files['name'];
    }
    if (isset($files)) {
        move_uploaded_file($files['tmp_name'], $url . time() . $nomb);
    } else {
        $nomb = '';
    }
    $data = $lugar->Set_lugares($id, $title, $subtitle, $descrip, time() . $nomb);
    echo json_encode($data);
}