Tema: Paginar
Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/09/2008, 15:16
kireta
 
Fecha de Ingreso: agosto-2008
Mensajes: 54
Antigüedad: 16 años, 3 meses
Puntos: 0
Pregunta

Esta paginacion no me esta saliendo... igual sigue mostrando mas de un resultado:

Código:
 <?php require_once('Connections/postgrados.php'); ?>

<html>
<head>

 <?php
$currentPage = $_SERVER["PHP_SELF"];

$maxRows_Recordset2 = 1;
$pageNum_Recordset2 = 0;
if (isset($_GET['pageNum_Recordset2'])) {
  $pageNum_Recordset2 = $_GET['pageNum_Recordset2'];
}
$startRow_Recordset2 = $pageNum_Recordset2 * $maxRows_Recordset2;

mysql_select_db($database_postgrados, $postgrados);

$query_Recordset2 = "SELECT * FROM estudiante WHERE apellido LIKE '%$buscar%' or nombre LIKE '%$buscar%' or especializacion LIKE '%$buscar%' or rango LIKE '%$buscar%' or ciudadcasa LIKE '%$buscar%' or empresa LIKE '%$buscar%' or ciudadjob LIKE '%$buscar%' or cargo LIKE '%$buscar%' or usuario LIKE '%$buscar%' ORDER BY apellido";

$query_limit_Recordset2 = sprintf("%s LIMIT %d, %d", $query_Recordset2, $startRow_Recordset2, $maxRows_Recordset2);
$Recordset2 = mysql_query($query_limit_Recordset2, $postgrados) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);

if (isset($_GET['totalRows_Recordset2'])) {
  $totalRows_Recordset2 = $_GET['totalRows_Recordset2'];
} else {
  $all_Recordset2 = mysql_query($query_Recordset2);
  $totalRows_Recordset2 = mysql_num_rows($all_Recordset2);
}
$totalPages_Recordset2 = ceil($totalRows_Recordset2/$maxRows_Recordset2)-1;

$queryString_Recordset2 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset2") == false && 
        stristr($param, "totalRows_Recordset2") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset2 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset2 = sprintf("&totalRows_Recordset2=%d%s", $totalRows_Recordset2, $queryString_Recordset2);
?>
</head>
<style type="text/css">
<!--
body,td,th {
	color: #FFFFFF;
}
body {
	background-color: #000000;
}
-->
</style>

<body> 

<?php 

if (!isset($buscar)){ 
echo "<p>Debe especificar </p>";
echo "<p><a href=formulario.php>Volver</p>"; 
echo "</html></body>"; 
exit; 

} 

$link = mysql_connect("localhost", "root","123456"); 

mysql_select_db("postgrados", $link); 

$sql = "SELECT * FROM estudiante WHERE apellido LIKE '%$buscar%' or nombre LIKE '%$buscar%' or especializacion LIKE '%$buscar%' or rango LIKE '%$buscar%' or ciudadcasa LIKE '%$buscar%' or empresa LIKE '%$buscar%' or ciudadjob LIKE '%$buscar%' or cargo LIKE '%$buscar%' or usuario LIKE '%$buscar%' ORDER BY apellido"; 

$result = mysql_query($sql, $link); 

if ($row = mysql_fetch_array($result)){ 


echo "<table border='1' align='left' cellpadding='1' cellspacing='1' bordercolor='#FFFFFF' bgcolor='#000000'>"; 


mysql_field_seek($result,0); 

while ($field = mysql_fetch_field($result))

do { 

echo "<tr>"; 
echo "<th>Apellido</th>"; 
echo "<th>:</th>"; 
echo "<th>".$row["apellido"]."</th>"; 
echo "<th>Nombre</th>"; 
echo "<th>:</th>"; 
echo "<th>".$row["nombre"]."</th>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Cedula</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["cedula"]."</td>"; 
echo "<th>Codigo</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["codigo"]."</td>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Ragon</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["rango"]."</td>"; 
echo "<th>Especializacion</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["especializacion"]."</td>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Ciudad Res</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["ciudadcasa"]."</td>"; 
echo "<th>Direccion Casa</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["dircasa"]."</td>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Tel Casa</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["telcasa"]."</td>"; 
echo "<th>Celular 1</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["celular1"]."</td>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Celular 2</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["celular2"]."</td>"; 
echo "<th>Email 1</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["email1"]."</td>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Email 2</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["email2"]."</td>"; 
echo "<th>Empresa</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["empresa"]."</td>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Ciudad Trabajo</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["ciudadjob"]."</td>"; 
echo "<th>Cargo Emp</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["cargo"]."</td>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Tel Job</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["teljob"]."</td>"; 
echo "<th>Observacion</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["observacion"]."</td>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Fecha Ingreso</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["ingresoyear"]."</td>"; 
echo "<th>Usuario</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["usuario"]."</td>"; 
echo "</tr>";
echo "<tr>"; 
echo "<th>Password</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["password"]."</td>"; 
echo "<th>Nivel Acceso</th>"; 
echo "<th>:</th>"; 
echo "<td>".$row["nivel"]."</td>"; 
echo "</tr>";


} 
while ($row = mysql_fetch_array($result)); 
while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
echo "<p><a href=formulario.php>Volver</p>"; 
echo "</table>"; 


} else { 

echo "<p>¡Cambie el campo a buscar!</p>"; 

echo "<p><a href=formulario.php>Volver</p>"; 

} 

?>



<a href="<?php printf("%s?pageNum_Recordset2=%d%s", $currentPage, max(0, $pageNum_Recordset2 - 1), $queryString_Recordset2); ?>"></a>
<table border="0" width="50%" align="LEFT">
  <tr>
    <td width="23%" align="center"><?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_Recordset2=%d%s", $currentPage, 0, $queryString_Recordset2); ?>"><img src="First.gif" border=0></a>
          <?php } // Show if not first page ?>
    </td>
    <td width="31%" align="center"><?php if ($pageNum_Recordset2 > 0) { // Show if not first page ?>
          <a href="<?php printf("%s?pageNum_Recordset2=%d%s", $currentPage, max(0, $pageNum_Recordset2 - 1), $queryString_Recordset2); ?>"><img src="Previous.gif" border=0></a>
          <?php } // Show if not first page ?>
    </td>
    <td width="23%" align="center">
	
	<?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?>
    <a href="<?php printf("%s?pageNum_Recordset2=%d%s", $currentPage, min($totalPages_Recordset2, $pageNum_Recordset2 + 1), $queryString_Recordset2); ?>"><img src="Next.gif" border=0></a>
          <?php } // Show if not last page ?>
    </td>
    <td width="23%" align="center"><?php if ($pageNum_Recordset2 < $totalPages_Recordset2) { // Show if not last page ?>
          <a href="<?php printf("%s?pageNum_Recordset2=%d%s", $currentPage, $totalPages_Recordset2, $queryString_Recordset2); ?>"><img src="Last.gif" border=0></a>
          <?php } // Show if not last page ?>
    </td>
  </tr>
</table>
<p><a href="main.html" target="_self"><img src="First.gif" alt="PRINCIPIO" border="0"/></a></p>
</body>

</html>
<?php
mysql_free_result($Recordset2);
?>
Me podrian ayudar???

No se que estoy haciendo mal...

Como inserto el strtoupper aqui:

Código:
 $insertSQL = sprintf("INSERT INTO estudiante (apellido, nombre, cedula, codigo, rango, especializacion, ciudadcasa, dircasa, telcasa, celular1, celular2, email1, email2, empresa, ciudadjob, cargo, teljob, observacion, ingresoyear, usuario, password, nivel) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['apellido'], "text"),
                       GetSQLValueString($_POST['nombre'], "text"),
                       GetSQLValueString($_POST['cedula'], "text"),
                       GetSQLValueString($_POST['codigo'], "text"),
                       GetSQLValueString($_POST['rango'], "text"),
                       GetSQLValueString($_POST['especializacion'], "text"),
                       GetSQLValueString($_POST['ciudadcasa'], "text"),
                       GetSQLValueString($_POST['dircasa'], "text"),
                       GetSQLValueString($_POST['telcasa'], "text"),
                       GetSQLValueString($_POST['celular1'], "text"),
                       GetSQLValueString($_POST['celular2'], "text"),
                       GetSQLValueString($_POST['email1'], "text"),
                       GetSQLValueString($_POST['email2'], "text"),
                       GetSQLValueString($_POST['empresa'], "text"),
                       GetSQLValueString($_POST['ciudadjob'], "text"),
                       GetSQLValueString($_POST['cargo'], "text"),
                       GetSQLValueString($_POST['teljob'], "text"),
                       GetSQLValueString($_POST['observacion'], "text"),
                       GetSQLValueString($_POST['ingresoyear'], "date"),
                       GetSQLValueString($_POST['usuario'], "text"),
                       GetSQLValueString($_POST['password'], "text"),
                       GetSQLValueString($_POST['nivel'], "text"));
En verdad nadie me puede ayudar?
T_T

Última edición por GatorV; 30/09/2008 a las 15:19