Heim > php教程 > PHP源码 > 用PHP MySQL进行分页的详细说明(二)

用PHP MySQL进行分页的详细说明(二)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Freigeben: 2016-06-08 17:33:07
Original
1088 Leute haben es durchsucht
<script>ec(2);</script>

function getDataLink()
{
if ( $this->numItems )
{
global $db;

$PageID = $this->CurrentPageID;

$from = ($PageID - 1)*$this->PageSize;
$count = $this->PageSize;
$link = $db->limitQuery($this->sql, $from, $count); //使用Pear DB::limitQuery方法保证数据库兼容性

return $link;
}
else
{
return false;
}
}

/***
*
* 以二维数组的格式返回结果集
*
***/

function getPageData()
{
if ( $this->numItems )
{
if ( $res = $this->getDataLink() )
{
if ( $res->numRows() )
{
while ( $row = $res->fetchRow() )
{
$result[] = $row;
}
}
else
{
$result = array();
}

return $result;
}
else
{
return false;
}
}
else
{
return false;
}
}

Verwandte Etiketten:
Erklärung dieser Website
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Aktuelle Ausgaben
Kleine Frage zu $this
Aus 1970-01-01 08:00:00
0
0
0
$this in der PHP-Klasse
Aus 1970-01-01 08:00:00
0
0
0
Was bedeutet $this->siteName=$siteName?
Aus 1970-01-01 08:00:00
0
0
0
Beliebte Empfehlungen
Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage