-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprob.php
69 lines (60 loc) · 1.84 KB
/
prob.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
<?php
//require("PHP/USER/Admin.php");
//$objAdmin = new UserAdmin();
//$objControladorAnime = new ControladorAnime();
//$objModeloAnime = new ModeloAnime();
//$objModeloConexion = new ModeloConexion();
function atrToString(array $valoresATR){
$clave= "";
$valor="";
foreach ($valoresATR as $key) {
$valor= $key;
if ($key!=count($valoresATR)-1 && count($valoresATR)!=1) {
$clave = $clave."'$valor', ";
}else {
$clave = $clave."'$valor'";
}
}
return $clave;
}
function atrToStringNombres($valoresATR){
$clave= "";
foreach ($valoresATR as $key) {
$valor= $key;
if ($key!=count($valoresATR)-1 && count($valoresATR)!=1) {
$clave = $clave."`$valor`, ";
}else {
$clave = $clave."`$valor`";
}
}
return $clave;
}
function sqlSet(array $columna, ... $valorAtributos){
$valores= atrToString($valorAtributos);
$columna= atrToStringNombres($columna);
$sql = "INSERT INTO tabla ($columna)
VALUES ($valores)";
return ($sql);
}
echo "<br><br>";
$array=[
"nombre"=>"nombre"
];
var_dump($array);
echo "<br><br>".(sqlSet(["nombre", "temporada", "capitulo", "estado"], "a", "1", "2", "visto"))
?>
<br>///////////////////////////////////////////////////////
<form action="PHP/PROB/ANIME/Listar.php" method="post">
<button type="submit">Listar</button>
</form>
<form action="PHP/PROB/ANIMES/BuscarNombre.php" method="post">
<input type="text" name="nombre">
<button type="submit">Buscar</button>
</form>
<form action="PHP/PROB/ESTADOS/Subir.php" method="post">
<input type="text" name="nombre">
<input type="text" name="temporada">
<input type="text" name="capitulo">
<input type="text" name="estado">
<button type="submit">Buscar</button>
</form>