0
나는 아래의 스크립트를 사용하고
당 20 ~ 10 기록에서 페이지 매김을 변경하지만 메신저는 어떤 이유로 그것을 변경하는 데 문제와 이유를 이해하지 못할 , 내가 한 모든 것은 20에서 10으로 바뀌지 만 어떤 이유로 페이지 당 5 개의 레코드가 표시됩니다 (현재 데이터베이스에는 11 개의 레코드가 있습니다).시도하고 페이지 당 10 개 개의 레코드를 보여 <a href="http://www.phpjabbers.com/php--mysql-select-data-and-split-on-pages-php25.html" rel="nofollow">http://www.phpjabbers.com/php--mysql-select-data-and-split-on-pages-php25.html</a></p> <p>>> 여기에서, 페이지
<?php
// check the user is part of the admin group
$connection = mysql_connect("localhost","root","");
if (!$connection)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("rcsetch", $connection);
if (isset($_GET["page"])) { $page = $_GET["page"]; } else { $page=1; };
$start_from = ($page-1) * 10;
$sql = "SELECT * FROM u5b0y_chronoforms_data_submitusedequipment ORDER BY cf_id ASC LIMIT $start_from, 10";
$rs_result = mysql_query ($sql,$connection);
?>
<table>
<tr><td>Name</td><td>Phone</td></tr>
<?php
while ($row = mysql_fetch_assoc($rs_result)) {
?>
<tr>
<td><? echo $row["manufacturer"]; ?></td>
<td><? echo $row["model"]; ?></td>
</tr>
<?php
};
?>
</table>
<?php
$sql = "SELECT COUNT(cf_id) FROM u5b0y_chronoforms_data_submitusedequipment";
$rs_result = mysql_query($sql,$connection);
$row = mysql_fetch_row($rs_result);
$total_records = $row[0];
$total_pages = ceil($total_records/10);
for ($i=1; $i<=$total_pages; $i++) {
echo "<a href='test.php?page=".$i."'>".$i."</a> ";
};
?>
변경하기 전에 작동 했습니까? –
11 레코드 만 있으므로 확실하지 않지만 모두 표시된대로 나타납니다. –
아, 쿼리가 정상적으로 작동하고 있음을 의미합니다./아마도 이는 테이블의 구조와 관련이 없음을 의미합니다. –