In the index of our site and also in the abdomen index were currently displaying are all the articles
in the database as we just saw.
This isn't a good idea if we have a lot of articles in the database.
So let's split them into pages instead.
In the index page were calling the get all method on the article class which returns an array of all
the article records in the database.
We might need this method at some point.
So instead of editing this one let's add a new method
which we'll call the Get page that will return a single page of articles instead in here.
We'll start with the same.
Q L but will add limit and offset clauses to it with corresponding.
Place holders for the values then as this is a prepared statement we'll prepare it then bind values
father place holders and these two values will pass in as arguments to the method.
Then will execute the statement and return an associative array of all the records.
And finally will add a p-h p doc.
Comments block to the method.
Then in the index page instead of calling.
Get are all lets call the Get page method.
Passing in values for the limit and offset this argument.
The limit is the number of articles per page which will set to 4.
The second argument is the offset which will start at zero to get the first page.
In the browser.
Now were shown only the first four records instead of all of them.
If we change the offset to four.
Then we see the second page of Ricardos.
Changing the offset to date.
We see page 3 and so on.