Asignar cadena texto a una variable con contador-Ayuda
Publicado por Luis (6 intervenciones) el 27/09/2020 13:31:45
Hola a todos!
Tengo un problema que no se solucionar pues antes funcionaba, se el problema, pero no la solución.
Tengo un formulario donde se puede seleccionar que calendario generar con ello se monta una consulta en Mysql dirigida a la base de datos pero un variable $igWhere[$filtActivos]="calendario_seccion.calendario"; etc.. no me toma la cadena completa de caracteres "calendario_seccion.calendario" solo tomas el primer carácter de la cadena es decir la "c" cuando antes funcionaba.
El fomulario cuentra con cuatro desplegable a seleccionar :
1.Sección sindical
2.Localidad
3.Comunidad Autonoma
4.Año
Pongo ngo el código
gracias por vuestra ayuda
Tengo un problema que no se solucionar pues antes funcionaba, se el problema, pero no la solución.
Tengo un formulario donde se puede seleccionar que calendario generar con ello se monta una consulta en Mysql dirigida a la base de datos pero un variable $igWhere[$filtActivos]="calendario_seccion.calendario"; etc.. no me toma la cadena completa de caracteres "calendario_seccion.calendario" solo tomas el primer carácter de la cadena es decir la "c" cuando antes funcionaba.
El fomulario cuentra con cuatro desplegable a seleccionar :
1.Sección sindical
2.Localidad
3.Comunidad Autonoma
4.Año
Pongo ngo el código
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
* Rellenar un ARRAY las fechas festivas a travás de una consulta a las fechas del calendario */
$cntArrDF=0;
$consultaFechCalend = mysqli_query($conexion, "SELECT * FROM calendario WHERE fechaA=".$year." AND fechaM=".$month.";");
while($cFechCalend = mysqli_fetch_array($consultaFechCalend))
{
$tiDi=$cFechCalend['tipoDia'];
/* Inicio Comprobar Filtros: */
/* INICIO SUPER FILTRO */
/* Contador de Filtros Activos */
$filtActivos=0;
$from="";
$where1="";
$where2="";
$igWhere="";
$where3="";
$whan="";
$igWhereF="";
if($cFechCalend['sindical']!=0){
if($filtActivos!=0){ $coma=", "; $whan=" AND "; }else{ $coma=""; $whan=" WHERE "; }
$from=$from.$coma."calendario_seccion";
$where1=$where1.$whan."calendario_seccion.activo='si' AND calendario_seccion.calendario=".$cFechCalend['id']."";
$where2=$where2." AND calendario_seccion.seccion=".$varSindical."";
$filtActivos++;
$igWhere[$filtActivos]="calendario_seccion.calendario";
}
if($cFechCalend['comunidad']!=0){
if($filtActivos!=0){ $coma=", "; $whan=" AND "; }else{ $coma=""; $whan=" WHERE "; }
$from=$from.$coma."calendario_comunidad";
$where1=$where1.$whan."calendario_comunidad.activo='si' AND calendario_comunidad.calendario=".$cFechCalend['id']."";
$where2=$where2." AND calendario_comunidad.comunidad=".$varComunidad."";
$filtActivos++;
$igWhere[$filtActivos]="calendario_comunidad.calendario";
}
if($cFechCalend['localidad']!=0){
if($filtActivos!=0){ $coma=", "; $whan=" AND "; }else{ $coma=""; $whan=" WHERE "; }
$from=$from.$coma."calendario_localidad";
$where1=$where1.$whan."calendario_localidad.activo='si' AND calendario_localidad.calendario=".$cFechCalend['id']."";
$where2=$where2." AND calendario_localidad.localidad=".$varLocalidad."";
$filtActivos++;
$igWhere[$filtActivos]="calendario_localidad.calendario";
// echo $igWhere[$filtActivos];
}
//Montaje del Filtro Comparador
if($filtActivos>1){
for($cff=1; $cff<=$filtActivos; $cff++){
if($cff<=$filtActivos){
$igWhereF=$igWhereF." AND ".$igWhere[$cff]." = ".$igWhere[$cff+1];
echo $igWhereF;
//echo $cff;
//echo $filtActivos;
//$igWhere[$filtActivos];
//var_dump($igWhere);
}
}
}
/* FIN SUPER FILTRO */
/* INICIO CONSULTA FILTRADA */
if($filtActivos!=0){
//$filtroCompleto = $from.$where1.$where2;
$filtroCompleto = $from.$where1.$where2.$igWhereF;
$fechList = mysqli_query($conexion, "SELECT * FROM ".$filtroCompleto.";");
if(!$fechList) {Var_dump(mysqli_error($conexion));
exit;
}
while($fList = mysqli_fetch_array($fechList))
{
$consultaFechList = mysqli_query($conexion, "SELECT * FROM calendario WHERE id=".$fList['calendario'].";");
$cFechList = mysqli_fetch_array($consultaFechList);
$DiasFestivos[$cntArrDF]="".$cFechList['fechaD']."/".$cFechList['fechaM']."-".$tiDi."";
$cntArrDF++;
}
}
/* FIN CONSULTA FILTRADA */
/* INICIO CONSULTA GENERAL */
if($cFechCalend['sindical']==0 and $cFechCalend['comunidad']==0 and $cFechCalend['localidad']==0){
$DiasFestivos[$cntArrDF]="".$cFechCalend['fechaD']."/".$cFechCalend['fechaM']."-".$tiDi."";
$cntArrDF++;
}
/* FIN CONSULTA GENERAL */
Valora esta pregunta


0