Foros del Web » Programando para Internet » PHP »

Ordenar por fecha (PHP Mysql)

Estas en el tema de Ordenar por fecha (PHP Mysql) en el foro de PHP en Foros del Web. Hola chicos, necesito ayuda con el siguiente código... Código PHP: <?php  if (! empty( $_SESSION [ "miSession" ])){ ?>      <table width="940" border="0" cellspacing="0" cellpadding="0">   <tr>     <td><hr /></td>   </tr>     <tr>     <td>&nbsp;</td>   </tr> ...
  #1 (permalink)  
Antiguo 03/12/2013, 11:07
 
Fecha de Ingreso: diciembre-2011
Mensajes: 32
Antigüedad: 12 años, 4 meses
Puntos: 1
Ordenar por fecha (PHP Mysql)

Hola chicos, necesito ayuda con el siguiente código...

Código PHP:
<?php 

if (! empty($_SESSION["miSession"])){
?>    
<table width="940" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><hr /></td>
  </tr>
    <tr>
    <td>&nbsp;</td>
  </tr>
</table>

<table width="960" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="280">Bienvenido
    <?php
    
echo $_SESSION['miSession']['user'];
    
if(
$_SESSION['miSession']['poder']=='1'){
    echo 
" ( Nivel, Visualizador )";
    
$level='1';
}
if(
$_SESSION['miSession']['poder']=='2'){
    echo 
" ( Nivel, Técnico )";
    
$level='2';
}
if(
$_SESSION['miSession']['poder']=='3'){
    echo 
" ( Nivel, Admin )";
    
$level='3';
}
if(
$_SESSION['miSession']['poder']=='4'){
    echo 
" ( Nivel, Super Admin )";
    
$level='4';
}
if(
$_SESSION['miSession']['poder']=='5'){
    echo 
" ( Nivel, Visualizador + Install )";
    
$level='5';
}
    
?>    
    </td>
    <td width="270"><form action="" method="post" name="form1" id="form1">
      <input type="text" name="buscarrut" id="buscarrut" placeholder=" Ingresa RUT" />
      <input type="submit" name="button2" id="button2" value="Filtro RUT" />
    </form></td>
    <td width="270"><form action="" method="post" name="form2" id="form2">
      <input type="text" name="buscarid" id="buscarid" placeholder=" ID Incidente" />
      <input type="submit" name="button" id="button" value="Filtro Incidente" />
    </form></td>
    <td width="140"><p align="center"><a class="cerrando" href="../data/cerrar.php">Cerrar sesión</a></p></td>
    </tr>
</table>

<table width="940" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td><hr /></td>
    </tr>
    <tr>
    <td>&nbsp;</td>
    </tr>
</table>

<!-- INCIDENTES EN PROCESO -->

<strong style="font-size:16px;">Reporte diario de soporte técnico</strong><br><br><br>
<?php 

$saberFecha
=mysql_query("SELECT fecha_inicio,fecha_termino FROM incidentes");

while(
$filas=mysql_fetch_array($saberFecha)){
            
$inicio=$filas['fecha_inicio'];
            
$termino=$filas['fecha_termino'];
            
            
$inicioSeparado explode(" ",$inicio);
            
$inicioSeparado[0]; //Fecha
            
$inicioSeparado[1]; //Hora
            
            
$diaSeparado explode("-",$inicioSeparado[0]);
            
$diaSeparado[0]; //Día
            
$diaSeparado[1]; //Mes
            
$diaSeparado[2]; //Año

for ($diaSeparado[0] = 1$diaSeparado[0] <= 31$diaSeparado[0]++) {

}}

$proceso=mysql_query("SELECT * FROM incidentes ORDER BY $diaSeparado[0]");

    while(
$filas=mysql_fetch_array($proceso)){
            
$idincident=$filas['id'];
            
$idcliente=$filas['id_cliente'];
            
$tipo=$filas['tipo'];
            
$inicio=$filas['fecha_inicio'];
            
$termino=$filas['fecha_termino'];
            
$problema=$filas['problema'];
            
$solucion=$filas['solucion'];
            
$open=$filas['tecnico_open'];
            
$tecnicoClose=$filas['tecnico_close'];
            
$tecnicoOpen=$filas['fecha_inicio'];
            
$termino=$filas['fecha_termino'];
            
$estado=$filas['estado'];
            

        
?>

<table width="940" border="0" cellspacing="0" cellpadding="0">
  <tr bgcolor="#33FF99" style="color:#FFF;">
    <td width="78" style="text-align:center;">
    <input type="text" value="<?php echo "IDI: ".$idincident?>" size="6" readonly style="text-align:center;"/>
    </td>
    <td width="404" style="color:#000;"><?php echo $tipo?></td>
    <td width="130" style="color:#000;"><?php echo $inicio;?></td>
    <td width="98"><div align="center"><a href="#" class="tooltip" style="color:#000;">Ver Problema<span><?php echo $problema;?></span></a></div></td>
    <td width="89">
    <form method="post" action="?p=solucionar&id=<?php echo $idcliente."&&incidente=".$idincident;?>">
        <div align="center"><input name="Enviar" type="submit" value="Solucionar" /></div>
    </form>
    </td>
    <td width="141"><div align="center" style="color:#F00;font-weight:bold;font-size:14px;">PROCESANDO</div></td>
  </tr>
</table> 
<br>
<?php }  ?>  
<!-- FIN INCIDENTES EN PROCESO -->

<!--/*OPEN*/-->
<?php    
}else{
    
header('Location:../');
}
?>
<!--/*CLOSE*/-->
el cual me da un resultado = a esto:

imagen => [URL="https://drive.google.com/file/d/0Bym-oiE6rg7aSzhmcVRjbEFNcm8/edit?usp=sharing"]https://drive.google.com/file/d/0Bym-oiE6rg7aSzhmcVRjbEFNcm8/edit?usp=sharing[/URL]

y necesito llegar a esto:

imagen => [URL="https://drive.google.com/file/d/0Bym-oiE6rg7aekEtT3A3NHktWDQ/edit?usp=sharing"]https://drive.google.com/file/d/0Bym-oiE6rg7aekEtT3A3NHktWDQ/edit?usp=sharing[/URL]

Espero alguien me pueda ayudar, saludos
  #2 (permalink)  
Antiguo 05/12/2013, 10:53
 
Fecha de Ingreso: mayo-2013
Mensajes: 19
Antigüedad: 11 años
Puntos: 0
Respuesta: Ordenar por fecha (PHP Mysql)

ya intentaste con

Código:
$proceso=mysql_query("SELECT * FROM incidentes ORDER BY fecha_inicio ASC");
?

Etiquetas: fecha, select, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 09:06.