我正在使用SQLite3,我正在尝试调整我发现的Paginator脚本.在改变看起来像是MYSQL命令之后,它有点起作用,但它没有显示正确数量的项目,并且似乎与它给出的结果不同.
我也收到以下错误,我不知道如何解决:
注意:未定义的索引:第27行的C:\ xampp\htdocs\Projects\index.php中的视频
我使用的代码是:
Paginator.php
_conn = $conn; $this->_query = $query; $rs= $this->_conn->query( $this->_query ); $this->_total = count($rs); } public function getData( $limit = 10, $page = 1 ) { $this->_limit = $limit; $this->_page = $page; if ( $this->_limit == 'all' ) { $query = $this->_query; } else { $query = $this->_query . " LIMIT " . ( ( $this->_page - 1 ) * $this->_limit ) . ", $this->_limit"; } $rs = $this->_conn->query( $query ); while ( $row = $rs->fetchArray() ) { $results[] = $row; } $results[] = []; $result = new stdClass(); $result->page = $this->_page; $result->limit = $this->_limit; $result->total = $this->_total; $result->data = $results; return $result; } public function createLinks( $links, $list_class ) { if ( $this->_limit == 'all' ) { return ''; } $last = ceil( $this->_total / $this->_limit ); $start = ( ( $this->_page - $links ) > 0 ) ? $this->_page - $links : 1; $end = ( ( $this->_page + $links ) < $last ) ? $this->_page + $links : $last; $html = '
的index.php
getData( $page, $limit ); ?>PHP Pagination PHP Pagination
data ); $i++ ) : ?>data[$i]['video']; ?>
createLinks($links, 'pagination pagination-sm'); ?>