consulta
Código PHP:
<?php require_once('includes/sesion.php'); ?>
<?php require_once('../Connections/aimm.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
$maxRows_Recordset1 = 30;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_aimm, $aimm);
$query_Recordset1 = "SELECT * FROM afiliacion ORDER BY sector ASC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $aimm) 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;
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_Recordset1") == false &&
stristr($param, "totalRows_Recordset1") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
y el resto
Código PHP:
<?php if ($totalRows_Recordset1!=0){ ?>
<table width="417" border="1" align="center" cellpadding="0" cellspacing="2" bordercolor="#022742">
<tr bgcolor="#333333" class="unnamed1">
<td width="121" bgcolor="#256581" class="tituloINDEX"><div align="center">opciones</div></td>
<td width="124" bgcolor="#256581" class="tituloINDEX"><div align="center">Sector</div></td>
<td width="156" bgcolor="#256581" class="tituloINDEX"><div align="center">Empresa</div></td>
<td width="156" bgcolor="#256581" class="tituloINDEX"><div align="center">Archivo</div></td>
</tr>
<?php do { ?>
<tr bgcolor="#FFFFFF" class="todopanel">
<td align="center"><a href="act_afiliados.php?id=<?php echo $row_Recordset1['id']; ?>">Modificar</a> <span class="textoINDEX">/</span> <a href="elim_afiliados.php?id=<?php echo $row_Recordset1['id']; ?>">Eliminar</a> </a> </td>
<td align="center" nowrap class="itemTEXTO"><?php echo $row_Recordset1['sector']; ?> </td>
<td align="center" class="itemTEXTO"><?php echo $row_Recordset1['empresa']; ?></td>
<td align="center" class="itemTEXTO"><?
if ($row_Recordset1['ficha']!="") {
?>
<a href="ficha/<?php echo $row_Recordset1['ficha']; ?>" target="_blank"><img src="../images/pdf.jpg" width="26" height="29" border="0" /></a>
<?
}else{
?>
<a href="#"><img src="../images/pdf.jpg" width="26" height="29" border="0" />
<? } ?></a></td>
</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<?php }?>
<br>
<table border="0" width="50%" align="center">
<tr class="Estilo6">
<td width="23%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">Primero</a>
<?php } // Show if not first page ?> </td>
<td width="31%" align="center"><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Anterior</a>
<?php } // Show if not first page ?> </td>
<td width="23%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Siguiente</a>
<?php } // Show if not last page ?> </td>
<td width="23%" align="center"><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Último</a>
<?php } // Show if not last page ?> </td>
</tr>
</table>
<div align="left"><span class="textoINDEX">Registros </span><span class="precioTEXTO"><?php echo ($startRow_Recordset1 + 1) ?></span><span class="textoINDEX"> a </span><span class="precioTEXTO"><?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?></span><span class="textoINDEX"> de </span><span class="precioTEXTO"><?php echo $totalRows_Recordset1 ?></span> </div></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
<tr>
<td align="center"><img src="imgs/footer.jpg" width="500" height="8"></td>
</tr>
<tr>
<td><div align="right"><br>
<a href="index.php"><img src="imgs/volver1.jpg" width="53" height="11" border="0" id="Image1" onMouseOver="MM_swapImage('Image1','','imgs/volver2.jpg',1)" onMouseOut="MM_swapImgRestore()"></a></div></td>
</tr>
<tr>
<td align="center"><span class="style3">AIMM Guayana. Todos los derechos reservados. Desarrollado por</span> <a href="http://www.naturaldesign.com.ve">Natural Design</a></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>