Ver Mensaje Individual
  #7 (permalink)  
Antiguo 03/09/2009, 23:33
Ojopex
 
Fecha de Ingreso: mayo-2009
Mensajes: 48
Antigüedad: 17 años, 5 meses
Puntos: 0
Respuesta: enlace en web modular no funciona

Hola, continuo con el problema pero una traba siguiente, les cuento:

Cambie el nombre de la variabla $page que estaba repetida a $cpage, bien, no me dio error, pero ahora no me cambia a la siguiente página de la compaginación, les muestro el código.



Código PHP:
<?php 
function select()
  {
  global 
$a;
  global 
$showrecs;
  global 
$cpage;

  
$res = sql_select();
  
$count = sql_getrecordcount();
  
$cpage = 1;
  if (
$count &#37; $showrecs != 0) {    //<<<no se porque sale eso como comentario seria ($count % $showrecs != 0) {
    
$pagecount = intval($count / $showrecs) + 1;
  }
  else {
    
$pagecount = intval($count / $showrecs);
  }
  
$startrec = $showrecs * ($cpage - 1);
  if (
$startrec < $count) {mysql_data_seek($res, $startrec);}
  
$reccount = min($showrecs * $cpage, $count);
?>
<table class="bd" border="0" cellspacing="1" cellpadding="4">
<tr><td><h2>Tabla Ciudad</h2></td></tr>
<tr><td>Mostrando Resultados <?php echo $startrec + 1 ?> al <?php echo $reccount ?> de <?php echo $count ?></td></tr>
</table>
<hr size="1" noshade>
<br>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="100%">
<tr>
<td class="hr">&nbsp;</td>
<td class="hr">&nbsp;</td>
<td class="hr">&nbsp;</td>
<td class="hr"><?php echo "cod" ?></td>
<td class="hr"><?php echo "nombre" ?></td>
</tr>
<?php
  
for ($i = $startrec; $i < $reccount; $i++)
  {
    
$row = mysql_fetch_assoc($res);
    
$style = "dr";
    if (
$i % 2 != 0) {
      
$style = "sr";
    }
?>
<tr>
<td class="<?php echo $style ?>"><a href="index.php?page=ciudad&a=view&recid=<?php echo $i ?>">Ver</a></td>
<td class="<?php echo $style ?>"><a href="index.php?page=ciudad&a=edit&recid=<?php echo $i ?>">Editar</a></td>
<td class="<?php echo $style ?>"><a href="index.php?page=ciudad&a=del&recid=<?php echo $i ?>">Borrar</a></td>
<td class="<?php echo $style ?>"><?php echo htmlspecialchars($row["cod"]) ?></td>
<td class="<?php echo $style ?>"><?php echo htmlspecialchars($row["nombre"]) ?></td>
</tr>
<?php
  
}
  
mysql_free_result($res);
?>
</table>
<br>
<?php showpagenav($cpage, $pagecount); ?>
<?php 
} ?>

<?php function showrow($row, $recid)
  {
?>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="50%">
<tr>
<td class="hr"><?php echo htmlspecialchars("cod")."&nbsp;" ?></td>
<td class="dr"><?php echo htmlspecialchars($row["cod"]) ?></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("nombre")."&nbsp;" ?></td>
<td class="dr"><?php echo htmlspecialchars($row["nombre"]) ?></td>
</tr>
</table>
<?php } ?>

<?php function showroweditor($row, $iseditmode)
  {
  global 
$conn;
?>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="50%">
<tr>
<td class="hr"><?php echo htmlspecialchars("nombre")."&nbsp;" ?></td>
<td class="dr"><input type="text" name="nombre" maxlength="50" value="<?php echo str_replace('"', '&quot;', trim($row["nombre"])) ?>">
</td>
</tr>

</table>

<?php } ?>

<?php function showpagenav($cpage, $pagecount)
{
?>

<table class="bd" border="0" cellspacing="1" cellpadding="4">
<tr>
<td><a href="index.php?page=ciudad&a=add">Agregar</a>&nbsp;</td>
<?php if ($cpage > 1) { ?>
<td><a href="index.php?page=ciudad&cpage=<?php echo $cpage - 1 ?>">&lt;&lt;&nbsp;Anterior</a>&nbsp;</td>
<?php } ?>
<?php
  
global $pagerange;

  if (
$pagecount > 1) {

  if (
$pagecount % $pagerange != 0) {
    
$rangecount = intval($pagecount / $pagerange) + 1;
  }
  else {
    
$rangecount = intval($pagecount / $pagerange);
  }
  for (
$i = 1; $i < $rangecount + 1; $i++) {
    
$startpage = (($i - 1) * $pagerange) + 1;
    
$count = min($i * $pagerange, $pagecount);

    if (((
$cpage >= $startpage) && ($cpage <= ($i * $pagerange)))) {
      for (
$j = $startpage; $j < $count + 1; $j++) {
        if (
$j == $cpage) {
?>
<td><b><?php echo $j ?></b></td>
<?php } else { ?>
<td><a href="index.php?page=ciudad&cpage=<?php echo $j ?>"><?php echo $j ?></a></td>
<?php } } } else { ?>
<td><a href="index.php?page=ciudad&cpage=<?php echo $startpage ?>"><?php echo $startpage ."..." .$count ?></a></td>
<?php } } } ?>
<?php 
if ($cpage < $pagecount) { ?>
<td>&nbsp;<a href="index.php?page=ciudad&cpage=<?php echo $cpage + 1 ?>">Next&nbsp;&gt;&gt;</a>&nbsp;</td>
<?php } ?>
</tr>
</table>
Ojalá me puedan ayudar es tan poquito lo que falta para esto y no entiendo por donde va la cosa.

Última edición por Ojopex; 03/09/2009 a las 23:40