Este es el codio.donde implemento ascendete y descendentemente.
<?php
$item = $_GET['var'];
$order = $_GET['order'];
$param = $order == "ASC" ? "DESC" :"ASC";
$var[0] = "id_cliente";
$var[1] = "cliente";
$var[2] = "contacto1";
$var[3] = "contacto2";
$var[4] = "contacto3";
$arr=$db->cliente1($item,$param);
?>
<td class = "table" align = "center" ><a class="tablebotonesprincipales" style="text-decoration:none" href ="Formulario_Cliente.php?var=<?php echo $var[1]?>&order=<?php echo $param?>">CLIENTE</a></td>
<td class = "table" align = "center" ><a class="tablebotonesprincipales" style="text-decoration:none" href ="Formulario_Cliente.php?var=<?php echo $var[2]?>&order=<?php echo $param?>">CONTACTO1</a></td>
<td class = "table" align = "center" ><a class="tablebotonesprincipales" style="text-decoration:none" href ="Formulario_Cliente.php?var=<?php echo $var[3]?>&order=<?php echo $param?>">CONTACTO2</a></td>
<td class = "table" align = "center" ><a class="tablebotonesprincipales" style="text-decoration:none" href ="Formulario_Cliente.php?var=<?php echo $var[4]?>&order=<?php echo $param?>">CONTACTO3</a></td>
<tbody style="overflow: hidden; overflow-y:scroll;" width="100px" height="400px ">
<?php
foreach($arr as $idx => $valor)
{
echo '
<tr >
</td><td width="8%" class="tablebotonesprincipales" align="center" > '.$valor[2]. ' </td><td width="8%" align="center" class="tablebotonesprincipales"> ' . $valor[3] . ' </td><td width="8%" class="tablebotonesprincipales" align="center"> ' . $valor[4] . ' </td><td align="center" class="tablebotonesprincipales"> ' . $valor[5] . ' </td>
<td align="center" >
<a class="tablebotonesprincipales" style="text-decoration:none"href ="Formulario_Cliente.php?module=editar&id=' . $valor[1] . '&cliente=' . $valor[2] . '&contacto1=' . $valor[3] . '&contacto2=' . $valor[4] . '&contacto3=' . $valor[5] . '" onclick ="procesar('{$valor[1]},{$valor[2]},{$valor[3]},{$valor[4]},{$valor[5]}')">Editar</a></td>
<td align="left" >
<a align="left" class="tablebotonesprincipales" style="text-decoration:none" href ="Formulario_Cliente.php?module=borrar&id=' . $valor[1] . '" onclick="return confirm ('¿Confirma que desea borrar?')">Borrar</a></td>
</td >'
?>
</td>
</tr>
<?php }
?>
[$y] = odbc_result($rs,$y);
$x++;
}
if ($x > 1)
{
return $arr;
}
}
?>