Foros del Web » Programando para Internet » PHP »

Ordenar Numerica Mente Una Consulta

Estas en el tema de Ordenar Numerica Mente Una Consulta en el foro de PHP en Foros del Web. TENGO UN ARCHIO PHP QUE REALIZA UNA CONSULTA DENTRO DE UNA TABLA, YO LE DOY LA ORDEN DENTRO DE ESE ARCHIVO PARA QUE CUANDO ME ...
  #1 (permalink)  
Antiguo 14/02/2008, 13:12
 
Fecha de Ingreso: septiembre-2007
Mensajes: 47
Antigüedad: 16 años, 7 meses
Puntos: 0
Ordenar Numerica Mente Una Consulta

TENGO UN ARCHIO PHP QUE REALIZA UNA CONSULTA DENTRO DE UNA TABLA, YO LE DOY LA ORDEN DENTRO DE ESE ARCHIVO PARA QUE CUANDO ME TRAIGA LOS DATOS ME LOS INCRUSTE EN UNA TABLA HTML Y FUERA DE ESO QUE ME ORDENE LOS DATOS POR EL CAMPO NUEMERO.

PERO NO ME ESTA ORDENANDO LA CONSULTA

ESTE ES EL CODIGO WEB
Código PHP:
<?php


 $txtconsulta
=$_REQUEST[' txtconsulta'];

$cn=mysql_connect("localhost","root","")or die ("no se puede establecer la coexion");

mysql_select_db("sisbagir");

$cons=("select * from INSTRUMENTO ORDER BY NUMERO ASC"); 
$resultado=mysql_query($cons);
    
$numfilas mysql_num_rows($resultado);
        if(
$numfilas == 0)
        {
          echo 
"No existen registros";
        }
        else
        {
    
?>
<style type="text/css">
<!--
.Estilo1 {font-weight: bold}
.Estilo10 {
    color: #008080;
    font-weight: bold;
}
.Estilo11 {color: #FF6600}
.Estilo12 {font-size: 10px; color: #0080C0; }
.Estilo14 {color: #999999; font-weight: bold; }
.Estilo15 {font-size: 9px}
-->
</style>

        <form action="imprimirinstrumentos.php" method="post">
        <div align="center">
          <p class="Estilo11"><strong>Listado de Asignacion de Instrumentos        </strong></p>
          <p class="Estilo11">&nbsp;</p>
        </div>
        <table border="0" align="center"><tr>
            <tr><th width="74"><div align="center" class="Estilo12">
                <div align="center">#</div>
            </div></th>
          
            <th width="74"><div align="center" class="Estilo12">
                <div align="center">REFERENCIA</div>
            </div></th>
            <th width="90"><div align="center" class="Estilo12">
                <div align="center">iNSTRUMENTO</div>
            </div></th>
            <th width="44"><div align="center" class="Estilo12">
                <div align="center">MARCA</div>
            </div></th>
            <th width="81"><div align="center" class="Estilo12">
                <div align="center">ACCESORIOS</div>
            </div></th>
            <th width="50"><div align="center" class="Estilo12">
                <div align="center">ESTADO</div>
            </div></th>
            <th width="69"><div align="center" class="Estilo12">
                <div align="center">NOMBRE COMPLETO</div>
            </div></th>
            <th width="105"><div align="center" class="Estilo12">
                <div align="center">ULTIMO MANTENIMIENTO</div>
            </div></th>
            <th width="105"> <div align="center" class="Estilo12">
                <div align="center">PROXIMO MANTENIMIENTO</div>
            </div></th>
            <th width="109"><div align="center" class="Estilo12">
                <div align="center">DIAS SIN MANTENIMIENTO</div>
            </div></th>
          </tr>
          <?
    
while ($numfilas mysql_fetch_array($resultado)) 
    {
     
asort ($numfilas); 

?>
          <tr>
            <td><div align="center" class="Estilo14"><span class="Estilo15"><? echo $numfilas["NUMERO"];?></span></div></td>
            <td><div align="center" class="Estilo14"><span class="Estilo15"><? echo $numfilas["REFERENCIA"];?></span></div></td>
            <td ><div align="center" class="Estilo14"><span class="Estilo15"><? echo $numfilas ["INSTRUMENTO"];?></span> </div></td>
            <td ><div align="center" class="Estilo14"><span class="Estilo15"><? echo $numfilas ["MARCA"];?></span> </div></td>
            <td ><div align="center" class="Estilo14"><span class="Estilo15"><? echo $numfilas ["ACCESRIOS"];?></span> </div></td>
            <td ><div align="center" class="Estilo14"><span class="Estilo15"><? echo $numfilas ["ESTADO"];?></span> </div></td>
            <td><div align="center" class="Estilo14"><span class="Estilo15"><? echo $numfilas ["NOMBRE_COMLETO"]; ?></span> </div></td>
            <td><div align="center" class="Estilo14"><span class="Estilo15"><? echo $numfilas ["ULTIMO_MANTENIMIENTO"]; ?></span> </div></td>
            <td><div align="center" class="Estilo14"><span class="Estilo15"><? echo $numfilas ["PROXIMO_MANTENIMIENTO"]; ?></span> </div></td>
            <td><div align="center" class="Estilo14"><? echo $numfilas ["DIAS_SIN_MANTE"];?> </div></td>
          </tr>
          <tr>
            <td colspan =  "6"><center>
              <input type="hidden" name = "txtcedula" value="<? echo $numfilas["id"]; ?>" />
            </center></td>
          </tr>
          <?
}
}
?>
        </table>
        <p>&nbsp;</p>
        <table width="746" border="0">
          <tr>
            <td width="76">&nbsp;</td>
            <td width="76">&nbsp;</td>
            <td width="76">&nbsp;</td>
            <td width="76">&nbsp;</td>
            <td><div align="center" class="Estilo10">
              <div align="right" class="Estilo11">Total de Instrumentos</div>
            </div></td>
            <td width="107">&nbsp;</td>
          </tr>
        </table>
        <p align="left" class="Estilo1">&nbsp;</p>
<form id="form1" name="form1" method="post" action="">
      <div align="center">
        <input type="submit" name="button" id="button" value="Imprimir" />
      </div>
    </form>
    </body></html>
  #2 (permalink)  
Antiguo 14/02/2008, 13:15
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Re: Ordenar Numerica Mente Una Consulta

¿Que tipo de campo es tu columna "NUMERO"?

Saludos.
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 13:15.