我再次回到了PHP mySQLi分页问题... 当我符文脚本时,它适用于第一页,但是当你点击链接到第二页时,链接可以正常工作,但是分页会消失。所以,如果我现在有3个链接,我看不到。 这是我的代码。
<?php
include_once ('myConnection.php');
if ( isset( $_GET["get_name"] ) ) {
$las_escuelas = $_GET["get_name"];
} else {
$las_escuelas = 1;
};
$start_from = ( $las_escuelas - 1 ) * 10;
$escuelas = "SELECT *
FROM escuelas
WHERE delegacion = '$delegacion'
AND nivel = '$nivel'
ORDER BY nombre ASC
LIMIT $start_from, 10";
$consulta = mysqli_query( $miguia, $escuelas ) or die ( mysqli_error() );
while ( $fila = mysqli_fetch_array( $consulta ) ) {
echo $fila['name'] . '<br>' . $fila['street'] . ' ' . $fila['numero'] . ' ' . $fila['place'] . ' ' . $fila['phone'] . '<br>';
};
$escuelas = "SELECT COUNT(delegacion)
FROM escuelas
WHERE delegacion = '$delegacion'
AND nivel = '$nivel'";
$consulta = mysqli_query( $miguia, $escuelas );
$fila = mysqli_fetch_row( $consulta );
$registros_total = $fila[0];
$paginas_total = ceil( $registros_total / 10 );
for ( $i = 1; $i <= $paginas_total; $i++ ) {
echo "<a href='resultados1.php?las_escuelas=".$i."'>".$i."</a> ";
};
?>
谢谢:)
答案 0 :(得分:0)
我认为(反向工程西班牙语代码很难)你应该从$ i = 0而不是1开始你的周期。