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.
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 was having a few problems creating a page with ampersands in the URL. This is a quick fix if it’s part of the HTML by using & but if it’s part of a javascript, it will take the code literally. For example, let’s say you have a javascript function that sends you to a…
Jeff called me up asking for help with his dedicated server on Godaddy. He needed to update his PHP 5.1.6 to the latest stable version. His server is running Centos 5.2 (Final). He tried to call Godaddy for assistance and of course they were no help. I’m no expert myself but have played around with…
I have been messing around with jQuery for a couple of days now and I think I’m getting the hang of it. Before using jQuery, I was using Mootools for processing forms to divs. It worked as intended but what I couldn’t do was create new javascript within the loaded pages. As interfaces get more…
I’ve been searching for a way to create a wrapper page within WordPress without having to install a plugin. I browsed the WordPress files and found wp-blog-header.php in the root install directory. It’s really simple. <?php require_once(‘wp-blog-header.php’); get_header(); // this is the content layout based on the current theme you are using get_sidebar(); get_footer(); ?>…
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…
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.