Two queries will be used for this task. The first query, you will count the rows of the recordset. The second query is the same as the first but it will have the LIMIT – this is what will be used to display the data on each page.
Let’s say we have the following table.
Now we’ll query the database and get the row count using PDO.
If you don’t use the bindValue, you will get an error in your query. Your second query would look something like this….
…and the error would occur right after LIMIT. You cannot have quotes surrounding the numbers. It took a few hours of Googling but found the solution.
A client at work wanted us to create a way to duplicate existing records on their website with a click of a button. These records involve multiple tables in the database. Some of the tables contained a lot of columns. We tried to do most of work using ASP but sometimes the browser would time…
I’ve been trying out the demo for Artisteer 2 and it’s great. Creating templates for popular CMS softwares such as WordPress, Joomla, and Drupal have never been easier. I’ve done some playing around with manually creating a WordPress template and it’s not too bad. The WordPress documentation is fairly easy to follow. But doing it…
I recently been playing around with Windows 2003 because we are still running Windows 2000 Server at work and may be upgrading soon. Our ASP pages are using includes to our database connection page… <!–#include file=”some_folder/db_connection_file.asp” –> If you were to run a page with that code on a Windows 2003 server, you may get…
I’m using the jQuery plugin from http://bassistance.de/jquery-plugins/jquery-plugin-validation. The plugin is greate. I did run into a problem with arrays. Say your form has a group of checkboxes or radio buttons and their names are checkbox or radio. To have them be in the same group, their names have to be the same and to process…
In the past it was always a bit challenging to get WIMP installed, at least for me it was. I ended up using installers for PHP and even then which version would I use, fast cgi or that other one (can’t seem to remember the name, it’s been a while). Recently, I had to create…
I’ve been checking out Python and Django and I’m impressed at what it can do. It’s efficient and has more things built-in compared to PHP and CodeIgniter. Unfortunately, I ran into some issues when installing the python-mysqldb. Without it, I can’t connect to MySQL – I could do sqlite3 fine though. I have existing projects…
One Comment
Thanks a whole bunch for this tutorial. It was a big help for a custom CMS I am writing. Once it is finished I will give you a thank you mention. Don’t understand why no one commented here. This is the only tutorial on making Pager work with PDO I could find. Thanks again.
Thanks a whole bunch for this tutorial. It was a big help for a custom CMS I am writing. Once it is finished I will give you a thank you mention. Don’t understand why no one commented here. This is the only tutorial on making Pager work with PDO I could find. Thanks again.