Ver Mensaje Individual
  #1 (permalink)  
Antiguo 11/12/2009, 10:41
shawn1986
 
Fecha de Ingreso: julio-2009
Mensajes: 63
Antigüedad: 14 años, 9 meses
Puntos: 0
Ayuda con paginacion php

Bueno antes que nada quiero enviarles un cordial saludo a todos.

El tema que voy a tratar seguramente esta super retocado, pero el problema es que soy nuevo en php y la verdad me esta costando mucho trabajo hacer mi codigo, el caso es que tengo una base de datos en mysql la cual con mucho trabajo ya la pude conectar con mi codigo php tanto para el envio de datos como para el muestro, el problema es que en esa base van a entrar muchisimos registros y no quisiera mostrarlos todos en la misma pagina, quisiera una ayudita para ver si con el codigo que ya tengo hecho me pudieran ayudar con aquello de la paginacion, he intentado con muchos codigos hechos pero no he logrado adaptarlos al mio.

De antemano les agradezco la atencion prestada y les deseo un excelente dia.


Este es mi codigo.

Código PHP:
Ver original
  1. <?php
  2. $server= "localhost";
  3. $usuario= "***********";
  4. $password= "**********";
  5. $db= "**********";
  6. //***********************************************************************************************************************************
  7. ?>
  8. <html>
  9. <head>
  10. <title>CONSULTA INVESTIGACIONES</title>
  11. <style type="text/css">
  12. <!--
  13. body {
  14.     font-family: "Trebuchet MS", Tahoma, Arial;
  15.     font-size: 12px;
  16.     color: #333333;
  17. }
  18. h2 {
  19.     font-size: 16px;
  20.     color: #CC0000;
  21. }
  22. input, select {
  23.     font-family: "Trebuchet MS", Tahoma, Arial;
  24.     font-size: 11px;
  25.     color: #666666;
  26. }
  27. -->
  28. </style>
  29. </head>
  30.  
  31. <body>
  32. <?php
  33.  
  34. $conexion= mysql_connect($server, $usuario, $password) or die ('problema conectando porque:' .mysql_error());
  35. mysql_select_db ($db, $conexion);
  36. $cadena="SELECT Folio,Nombre,Radios,Ciudad,Respuesta,Observaciones_Investigacion,Respuesta_Reinvestigacion,
  37. Observaciones_Reinvestigacion,Fecha_Solicitud,Agencia,Tipo_Contrato,Fecha_Recepcion,Local_Foranea,Municipio_Delegacion,Causa,
  38. Causa_Reinvestigacion FROM layout ORDER BY Id DESC";
  39.  
  40. //***********************************************************************************************************************************
  41. $tabla=mysql_query($cadena,$conexion) or die ("Problema con cadena de conexion<br><b>" .mysql_error()."</br>");
  42. $registrosencontrados=mysql_num_rows($tabla);
  43. echo "<font face='Calibri' style='font-size: 14pt' color='#FFFF66'>Vista Contratos México.</font><hr color='#FF0000' width='100%'>";
  44. echo "Encontrados: ".$registrosencontrados."<br><br>";
  45. while ($row=mysql_fetch_array($tabla)){
  46. //***********************************************************************************************************************************
  47.  
  48. echo "<table border='0' cellpadding='0' style='border-collapse: collapse'>";
  49. echo "<tr>";
  50.  
  51. echo "<td><font face='Calibri' style='font-size: 10pt'><palign='center'><b>FOLIO:</font></td>";
  52. echo "<td><font face='Calibri' style='font-size: 10pt'><b>NOMBRE:</font></td>";
  53. echo "<td><font face='Calibri' style='font-size: 10pt'><b>RADIOS:</font></td>";
  54. echo "<td><font face='Calibri' style='font-size: 10pt'><b>CIUDAD:</font></td>";
  55. echo "<td><font face='Calibri' style='font-size: 10pt'><b>RESPUESTA:</font></td>";
  56. echo "<td><font face='Calibri' style='font-size: 10pt'><b>OBSERVACIONES:</font></td>";
  57. echo "<td><font face='Calibri' style='font-size: 10pt'><b>RESP.*REINVESTIGACION:</font></td>";
  58. echo "<td><font face='Calibri' style='font-size: 10pt'><b>OBS. REINVESTIGACION:</font></td>";
  59. echo "<td><font face='Calibri' style='font-size: 10pt'><b>FECHA SOLICITUD:</font></td>";
  60. echo "<td><font face='Calibri' style='font-size: 10pt'><b>AGENCIA:</font></td>";
  61. echo "<td><font face='Calibri' style='font-size: 10pt'><b>TIPO CONTRATO:</font></td>";
  62. echo "<td><font face='Calibri' style='font-size: 10pt'><b>FECHA RECEPCION:</font></td>";
  63. echo "<td><font face='Calibri' style='font-size: 10pt'><b>LOCAL/FORANEA:</font></td>";
  64. echo "<td><font face='Calibri' style='font-size: 10pt'><b>MUNICIPIO/DELEGACION:</font></td>";
  65. echo "<td><font face='Calibri' style='font-size: 10pt'><b>CAUSA:</font></td>";
  66. echo "<td><font face='Calibri' style='font-size: 10pt'><b>CAUSA REINVESTIGACION:</font></td>";
  67.  
  68. echo "<tr>";
  69. echo "<td><input type='textbox' name='Folio' size='17' style='text-align: center' value='".$row['Folio']."'>*</td>";
  70. echo "<td><input type='textbox' name='Nombre' size='50' value='".$row['Nombre']."'>*</td>";
  71. echo "<td><input type='textbox' name='Radios' size='6' style='text-align: center' value='".$row['Radios']."'>*</td>";
  72. echo "<td><input type='textbox' name='Ciudad' size='20' style='text-align: center' value='".$row['Ciudad']."'>*</td>";
  73. echo "<td><input type='textbox' name='Respuesta' size='25' style='text-align: center' value='".$row['Respuesta']."'>*</td>";
  74. echo "<td><input type='textbox' name='Observaciones' size='30' value='".$row['Observaciones_Investigacion']."'>*</td>";
  75. echo "<td><input type='textbox' name='Respuesta_Reinvestigacion' size='25' style='text-align: center' value='".$row['Respuesta_Reinvestigacion']."'>*</td>";
  76. echo "<td><input type='textbox' name='Observaciones_Reinvestigacion' size='30' value='".$row['Observaciones_Reinvestigacion']."'>*</td>";
  77. echo "<td><input type='textbox' name='Fecha_Solicitud' size='25' style='text-align: center' value='".$row['Fecha_Solicitud']."'>*</td>";
  78. echo "<td><input type='textbox' name='Agencia' size='15' style='text-align: center' value='".$row['Agencia']."'>*</td>";
  79. echo "<td><input type='textbox' name='Tipo_Contrato' size='17' style='text-align: center' value='".$row['Tipo_Contrato']."'>*</td>";
  80. echo "<td><input type='textbox' name='Fecha_Recepcion' size='25' style='text-align: center' value='".$row['Fecha_Recepcion']."'>*</td>";
  81. echo "<td><input type='textbox' name='Local_Foranea' size='17' style='text-align: center' value='".$row['Local_Foranea']."'>*</td>";
  82. echo "<td><input type='textbox' name='Municipio_Delegacion' size='25' style='text-align: center' value='".$row['Municipio_Delegacion']."'>*</td>";
  83. echo "<td><input type='textbox' name='Causa' size='25' style='text-align: center' value='".$row['Causa']."'>*</td>";
  84. echo "<td><input type='textbox' name='Causa_Reinvestigacion' size='25' style='text-align: center' value='".$row['Causa_Reinvestigacion']."'>*</td>";
  85.  
  86. echo "<hr size='0' noshade color='#FFFFFF'>";
  87. echo "</tr>";
  88. echo "</table>";
  89.  
  90. //***********************************************************************************************************************************
  91. }
  92. ?>
  93. </body>
  94. </html>