/clases/dame_fotos.php
https://bitbucket.org/weddcam/develop_weddcam · PHP · 63 lines · 61 code · 2 blank · 0 comment · 12 complexity · 11e8bedcd92145a3243f32a912af54fa MD5 · raw file
- <?php
- header('Content-type: application/json');
- include 'conexion_publico.php';
- $cuantos=false;$primvez=true;
- $dml = "select nombre_foto, titulo "
- ." from v_ranking_fotos_mes "
- ." where ano_voto='".$_POST['ano']."' and mes_voto='".$_POST['mes']."' and id_categoria='1' "
- ." order by ano_voto desc, mes_voto desc,id_categoria, numero_votos desc limit 25";
- $result = mysql_query($dml) or die("error-leer_fotos".mysql_error());
- while ( $aRow = mysql_fetch_array( $result ) )
- {
- if ($primvez) {$cuantos= true;$primvez=false;$output[0][] = '1';}
- $output[0][]=$aRow['nombre_foto'].'[crm]'.$aRow['titulo'];
- }
- if (!$cuantos) {
- $output[0][0] = '0';
- }
- $primvez=true;$cuantos=false;
- $dml = "select nombre_foto, titulo "
- ." from v_ranking_fotos_mes "
- ." where ano_voto='".$_POST['ano']."' and mes_voto='".$_POST['mes']."' and id_categoria='2' "
- ." order by ano_voto desc, mes_voto desc,id_categoria, numero_votos desc limit 25";
- $result = mysql_query($dml) or die("error-leer_fotos".mysql_error());
- while ( $aRow = mysql_fetch_array( $result ) )
- {
- if ($primvez) {$cuantos= true;$primvez=false;$output[1][] = '1';}
- $output[1][]=$aRow['nombre_foto'].'[crm]'.$aRow['titulo'];
- }
- if (!$cuantos) {
- $output[1][0] = '0';
- }
- $primvez=true;$cuantos=false;
-
- $dml = "select nombre_foto, titulo "
- ." from v_ranking_fotos_mes "
- ." where ano_voto='".$_POST['ano']."' and mes_voto='".$_POST['mes']."' and id_categoria='3' "
- ." order by ano_voto desc, mes_voto desc,id_categoria, numero_votos desc limit 25";
- $result = mysql_query($dml) or die("error-leer_fotos".mysql_error());
- while ( $aRow = mysql_fetch_array( $result ) )
- {
- if ($primvez) {$cuantos= true;$primvez=false;$output[2][] = '1';}
- $output[2][]=$aRow['nombre_foto'].'[crm]'.$aRow['titulo'];
- }
- if (!$cuantos) {
- $output[2][0] = '0';
- }
- $primvez=true;$cuantos=false;
-
- $dml = "select nombre_foto, titulo "
- ." from v_ranking_fotos_mes "
- ." where ano_voto='".$_POST['ano']."' and mes_voto='".$_POST['mes']."' and id_categoria='4' "
- ." order by ano_voto desc, mes_voto desc,id_categoria, numero_votos desc limit 25";
- $result = mysql_query($dml) or die("error-leer_fotos".mysql_error());
- while ( $aRow = mysql_fetch_array( $result ) )
- {
- if ($primvez) {$cuantos= true;$primvez=false;$output[3][] = '1';}
- $output[3][]=$aRow['nombre_foto'].'[crm]'.$aRow['titulo'];
- }
- if (!$cuantos) {
- $output[3][0] = '0';
- }
- echo json_encode( $output );
- ?>