Ver Mensaje Individual
  #4 (permalink)  
Antiguo 28/05/2008, 08:54
Avatar de T4ke0veR
T4ke0veR
 
Fecha de Ingreso: agosto-2007
Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 16 años, 8 meses
Puntos: 28
Respuesta: Order by en pagina web tras mostrar unos registros...

ok fijate..
haces tu consulta ordenando pola llave primaria... me imagino q es un id o un campo int auto_increment..
luego en donde hces la consulta haces eso
esto s un ejemplo d como lo hice con mi archivo

Código PHP:
<?php require_once('Connections/pintor.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

  
$theValue function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch (
$theType) {
    case 
"text":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;    
    case 
"long":
    case 
"int":
      
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case 
"double":
      
$theValue = ($theValue != "") ? "'" doubleval($theValue) . "'" "NULL";
      break;
    case 
"date":
      
$theValue = ($theValue != "") ? "'" $theValue "'" "NULL";
      break;
    case 
"defined":
      
$theValue = ($theValue != "") ? $theDefinedValue $theNotDefinedValue;
      break;
  }
  return 
$theValue;
}
}

$maxRows_Recordset1 10;
$pageNum_Recordset1 0;
if (isset(
$_GET['pageNum_Recordset1'])) {
  
$pageNum_Recordset1 $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 $pageNum_Recordset1 $maxRows_Recordset1;

mysql_select_db($database_pintor$pintor);
$query_Recordset1 "SELECT * FROM rrhh ORDER BY id DESC";
$query_limit_Recordset1 sprintf("%s LIMIT %d, %d"$query_Recordset1$startRow_Recordset1$maxRows_Recordset1);
$Recordset1 mysql_query($query_limit_Recordset1$pintor) or die(mysql_error());
$row_Recordset1 mysql_fetch_assoc($Recordset1);

if (isset(
$_GET['totalRows_Recordset1'])) {
  
$totalRows_Recordset1 $_GET['totalRows_Recordset1'];
} else {
  
$all_Recordset1 mysql_query($query_Recordset1);
  
$totalRows_Recordset1 mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="3" class="sortable-onload-3-reverse rowstyle-alt no-arrow" id="test1">  
<caption>&nbsp;
</caption>  <thead>    <tr>      <th width="146" class="fd-column-1 sortable-text" style="-moz-user-select: none;"><a title="Sort on â€œPrev.Rankâ€" href="#">Nombres</a></th>      
<th width="148" class="fd-column-2 sortable-text" style="-moz-user-select: none;"><a title="Sort on â€œMovieâ€" href="#">Apellidos</a></th>      
<th width="121" class="fd-column-3 sortable-text" style="-moz-user-select: none;"><a title="Sort on â€œRelease Dateâ€" href="#">Sexo</a></th>      
<th width="125" class="fd-column-4 sortable-text" style="-moz-user-select: none;"><a title="Sort on â€œWeekly Grossâ€" href="#">E-Mail</a></th>      
<th width="117" class="fd-column-5 sortable-text" style="-moz-user-select: none;"><a title="Sort on â€œChangeâ€" href="#">País</a></th>      
<th width="134" class="fd-column-6 sortable-text" style="-moz-user-select: none;"><a title="Sort on â€œTheatersâ€" href="#">Estado</a></th>      
<th width="152" class="fd-column-7 sortable-text" style="-moz-user-select: none;"><a title="Sort on â€œPer Theaterâ€" href="#">Edo. Civil</a></th>      
  
    <th width="36" class="" style="-moz-user-select: none;">Ver</th>    
</tr>  </thead>  <tbody>  <?php do { ?> <tr class="">      
 
    <td><div align="center"><?php echo $row_Recordset1['nombres']; ?></div></td>
    <td class="lft"><div align="center"><?php echo $row_Recordset1['apellidos']; ?></div></td>
    <td><div align="center"><?php echo $row_Recordset1['sexo']; ?></div></td>
    <td><div align="center"><?php echo $row_Recordset1['email']; ?></div></td>
    <td><div align="center"><?php echo $row_Recordset1['pais']; ?></div></td>
    <td><div align="center"><?php echo $row_Recordset1['estado']; ?></div></td>
    <td><div align="center"><?php echo $row_Recordset1['estadocivil']; ?></div></td>
    <td><div align="right">ver ficha</div></td>
    
</tr><?php } while ($row_Recordset1 mysql_fetch_assoc($Recordset1)); ?></tbody>  <tfoot>  </tfoot></table>
<script type="text/javascript" src="tablesort.js"></script>
</body></html>   
<?php
mysql_free_result
($Recordset1);
?>
__________________
Diseño gráfico, Web, imagen corporativa, publicidad ...