Ver Mensaje Individual
  #5 (permalink)  
Antiguo 21/09/2006, 13:48
Murallitz
 
Fecha de Ingreso: diciembre-2001
Ubicación: Peru
Mensajes: 376
Antigüedad: 23 años, 2 meses
Puntos: 0
ok te paso el codigo para visualisar datos de la tabla


Código PHP:
<?php require_once('Connections/cn.php'); ?>
<?php
$currentPage 
$HTTP_SERVER_VARS["PHP_SELF"];

$maxRows_rs 10;
$pageNum_rs 0;
if (isset(
$HTTP_GET_VARS['pageNum_rs'])) {
  
$pageNum_rs $HTTP_GET_VARS['pageNum_rs'];
}
$startRow_rs $pageNum_rs $maxRows_rs;

mysql_select_db($database_cn$cn);
$query_rs "SELECT ID_Agenda, Nombre, Apellido, Titulo, Cargo FROM tblagenda";
$query_limit_rs sprintf("%s LIMIT %d, %d"$query_rs$startRow_rs$maxRows_rs);
$rs mysql_query($query_limit_rs$cn) or die(mysql_error());
$row_rs mysql_fetch_assoc($rs);

if (isset(
$HTTP_GET_VARS['totalRows_rs'])) {
  
$totalRows_rs $HTTP_GET_VARS['totalRows_rs'];
} else {
  
$all_rs mysql_query($query_rs);
  
$totalRows_rs mysql_num_rows($all_rs);
}
$totalPages_rs ceil($totalRows_rs/$maxRows_rs)-1;

$queryString_rs "";
if (!empty(
$HTTP_SERVER_VARS['QUERY_STRING'])) {
  
$params explode("&"$HTTP_SERVER_VARS['QUERY_STRING']);
  
$newParams = array();
  foreach (
$params as $param) {
    if (
stristr($param"pageNum_rs") == false && 
        
stristr($param"totalRows_rs") == false) {
      
array_push($newParams$param);
    }
  }
  if (
count($newParams) != 0) {
    
$queryString_rs "&" implode("&"$newParams);
  }
}
$queryString_rs sprintf("&totalRows_rs=%d%s"$totalRows_rs$queryString_rs);
?>
<?php 
require_once('Connections/cn.php'); ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="600" border="0">
  <tr bgcolor="#000000"> 
    <td width="130"><strong><font color="#FFFFFF" face="Century Gothic">Id</font></strong></td>
    <td width="101"><strong><font color="#FFFFFF" face="Century Gothic">Titulo</font></strong></td>
    <td width="209"><strong><font color="#FFFFFF" face="Century Gothic">Nombre</font></strong></td>
    <td width="142"><strong><font color="#FFFFFF" face="Century Gothic">Cargo</font></strong></td>
  </tr>
  <?php do { ?>
  <tr> 
    <td><font size="3" face="Century Gothic">&nbsp;<?php echo $row_rs['ID_Agenda']; ?></font></td>
    <td><font size="3" face="Century Gothic">&nbsp;<?php echo $row_rs['Titulo']; ?></font></td>
    <td><font size="3" face="Century Gothic"><?php echo $row_rs['Apellido']; ?><?php echo $row_rs['Nombre']; ?></font></td>
    <td><?php echo $row_rs['Cargo']; ?></td>
  </tr>
  <?php } while ($row_rs mysql_fetch_assoc($rs)); ?>
</table>
<table width="412" border="0">
  <tr> 
    <td width="74">
<div align="center"><font size="2" face="Century Gothic"><a href="<?php printf("%s?pageNum_rs=%d%s"$currentPage0$queryString_rs); ?>">Inicio</a></font></div></td>
    <td width="82">
<div align="center"><font size="2" face="Century Gothic"><a href="<?php printf("%s?pageNum_rs=%d%s"$currentPagemax(0$pageNum_rs 1), $queryString_rs); ?>">Anterior</a></font></div></td>
    <td width="113">
<div align="center"><font size="2" face="Century Gothic"><a href="<?php printf("%s?pageNum_rs=%d%s"$currentPagemin($totalPages_rs$pageNum_rs 1), $queryString_rs); ?>">Siguiente</a></font></div></td>
    <td width="125">
<div align="center"><font size="2" face="Century Gothic"><a href="<?php printf("%s?pageNum_rs=%d%s"$currentPage$totalPages_rs$queryString_rs); ?>">Ultimo</a></font></div></td>
  </tr>
</table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result
($rs);
mysql_close() 
?>

Última edición por Cluster; 21/09/2006 a las 14:25