終于運行成功
<?php
//連接數(shù)據(jù)庫
error_reporting(0);?
mysql_connect('127.0.0.1', 'code1', '');
mysql_select_db('code1');
mysql_query("set names 'utf8'");
//預設翻頁參數(shù)
$page = 2;
$pagesize = 2;
//offset就相當于當前第幾條數(shù)據(jù)
$offset = ($page-1)*$pagesize;
//從第幾條數(shù)據(jù)開始,顯示幾條數(shù)據(jù)
$sql = '"select * from user limit $offset,$pagesize"';
//獲取翻頁數(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ù)庫不存在的情況下也只能用? error_reporting(0);? ?來偷雞了??
2021-05-26
棒棒的