終于運(yùn)行成功
<?php
//連接數(shù)據(jù)庫(kù)
error_reporting(0);?
mysql_connect('127.0.0.1', 'code1', '');
mysql_select_db('code1');
mysql_query("set names 'utf8'");
//預(yù)設(shè)翻頁(yè)參數(shù)
$page = 2;
$pagesize = 2;
//offset就相當(dāng)于當(dāng)前第幾條數(shù)據(jù)
$offset = ($page-1)*$pagesize;
//從第幾條數(shù)據(jù)開(kāi)始,顯示幾條數(shù)據(jù)
$sql = '"select * from user limit $offset,$pagesize"';
//獲取翻頁(yè)數(shù)據(jù)
$result = mysql_query($sql);
$data = array();
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
? ? $data[] = $row;
}
echo '<pre>';
print_r($data);
echo '</pre>';
2022-03-08
在數(shù)據(jù)庫(kù)不存在的情況下也只能用? error_reporting(0);? ?來(lái)偷雞了??
2021-05-26
棒棒的