BenGriffiths / pdo-mysqli-pagination

A PDO & MySQLi PHP Pagination Class - PDO MySQLi Pagination class is a PHP pagination class that will work with either PDO, or MySQLi. The outputted pagination is served as a UL or as an array, and the options are extensive.
50 stars 27 forks source link

Mod Rewrite #19

Closed tmblog closed 9 years ago

tmblog commented 9 years ago

I'm using it with rewritten urls like this:

/test/page/1 etc $options = array( 'results_per_page' => 6, 'url' => 'http://example.com/test/page/*VAR*', 'db_handle' => $conn );

But I get errors, Can this be used with rewritten urls? Works fine without it.

BenGriffiths commented 9 years ago

It can yeah - what errors exactly are you getting?

tmblog commented 9 years ago

Thanks for the quick reply. Well the first page is fine, Im using default config on changed the url structure as above. Here's the errors.

Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-6, 6' at line 1' in /home/#####/public_html/inc/pagination.php:376 Stack trace: #0 /home/####/public_html/inc/pagination.php(376): PDOStatement->execute() #1 /home/######/public_html/inc/pagination.php(202): pagination->excecute_query() #2 /home/######/public_html/inc/pagination.php(162): pagination->run('page', 'SELECT pic_id,p...', Array) #3 /home/#####/public_html/test.php(44): pagination->__construct('page', 'SELECT pic_id,p...', Array) #4 {main} thrown in /home/#######/public_html/inc/pagination.php on line 376

BenGriffiths commented 9 years ago

And how are you passing the page number variable? Have you verified it contains your page number?

tmblog commented 9 years ago

Yes the links look like this

/test/page/1 /test/page/2

tmblog commented 9 years ago

ok if i take out the page it works fine!

BenGriffiths commented 9 years ago

Sorry I meant how are you passing the number in your URL to the pagination method, have you verified that you are passing the correct thing?

tmblog commented 9 years ago

Ye thanks for the pointer! all sorted! :-)

BenGriffiths commented 9 years ago

Excellent!