-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpeliculas.php
111 lines (80 loc) · 3.5 KB
/
peliculas.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<title>Videoclub</title>
</head>
<body>
<script type="text/javascript">
function confirmar() {
var idE = document.getElementById("idE").value;
if(confirm("¿ESTAS SEGUR@?"))
{window.location = "eliminar_pelicula.php?id="+idE;
}
}
</script>
<?php
require 'header.php';
require 'conexion.php';
echo "<div class='container'><h1>Peliculas</h1>";
echo "<form class='form-inline' method='GET' action='peliculas.php'>
<input class='form-control mr-sm-2' name='busqueda' type='search' placeholder='Buscar' aria-label='Search'>
<button class='btn btn-outline-success my-2 my-sm-0' type='submit'>Buscar</button>
</form>";
//echo "<a class='btn btn-success' href='agregar_pelicula.php'>Añadir pelicula</a>";
echo "<br>";
echo "<br>";
//if(isset($_REQUEST['busqueda'])){
if(isset($_REQUEST['busqueda'])){
$busqueda = $_REQUEST['busqueda'];
$peliculas = $conexion->query("SELECT * FROM peliculas WHERE titulo LIKE '%$busqueda%'");
}else{
$peliculas = $conexion->query("SELECT * FROM peliculas");
}
//$peliculas = $conexion->query("SELECT * FROM peliculas");
// }else{
// $peliculas = $conexion->query("SELECT * FROM peliculas");
// echo "ADIOS";
//}
echo "<a class='btn btn-primary btn-nueva' href='agregar_pelicula.php'><i class='fa fa-plus'></i> Añadir Película </a>";
echo "<table class='table table-bordered grocery-crud-table table-hover'>
<thead>
<tr>
<th>Título</th>
<th>Genero</th>
<th>País</th>
<th>Año</th>
<th>Cartel</th>
<th>Acciones</th>
</tr>
</thead>";
while ($fila = $peliculas->fetch_object()) {
echo "<tbody>
<tr>
<td>$fila->titulo</td>
<td>
$fila->genero
</td>
<td>
$fila->pais
</td>
<td>
$fila->anyo
</td>
<td>
<img class='card-img-top col-md-4 d-none d-md-block ml-6' src='$fila->cartel' alt='Cartel'>
</td>
<td>
<a class='btn btn-success' href='$fila->trailer' target='_blank'>Ver trailer</a>
<a class='btn btn-warning' href='editar_pelicula.php?id=$fila->id'>Editar</a>
<input id='idE' type='hidden' value= '$fila->id'><a class='btn btn-danger' onclick='confirmar()'>Eliminar</a>
</td>
</tr>
<?php } ?>
</tbody>";
}
echo "</table></div>";