我又回来了一个 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> ";
};
?>
谢谢 :)