PHP Tutorials: Pagination (Part 1)

18 04 2011

Visit the forum for help! phpacademy.info Follow on Twitter! twitter.com Paginating results from a MySQL database. This is a (almost) simple method of showing paginated results effectively.
Video Rating: 4 / 5


Actions

Information

25 responses

18 04 2011
nickolajmadsen

AWESOME THX ALEX! 😀

I’m building a site where people can watch full lenght movies
I really needed this! 😀

18 04 2011
mhamlet1

Why you don’t write?
$record_count = mysql_query(“SELECT COUNT(*) FROM data”);

18 04 2011
n0b0dy241

Ok… but what if somebody is a litle more smarter, and types start=-1(example) ? Is there a way to prevent that ?

18 04 2011
breakfastbgood

Does anyone know where I can find out how to create a a drop down list next to the page results that lets the user chose how the results are to be sorted, such as by ascending, descending and alphabetical order?

18 04 2011
poxbag1

@sotvisal7 try $start = &$_GET[‘start’]

18 04 2011
madmatthew1

how would you do that with your search engine script?

18 04 2011
DANJUMA9

Men what would I DO WITHOUT YOU. SENDING MUCH LOVE FROM CINCINNATI, OHIO.

18 04 2011
PhoenixG94

Is there anywhere I can download the source files for your tutorials? Thanks.

18 04 2011
saadnaeem11

you are absulotely superb man thnks alot you save my great time 🙂

18 04 2011
humaliwalay110able

This pagination was very easy to learn. but can you please make it more dynamic look in Css. i will be thank full …

18 04 2011
EatY0urShit

Help!

I was in the process of learning but his code has a lot of bugs..
I rewrote his code 100% and found out it has a lot of bugs..

First:
Notice! Undefined Index of start variable..

Second:
Warning! mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in..

the second bug really gave me a headache..
please solve this..
how come his error wont come up while i had mine..
was it his using an old version of php?..
pls help..

18 04 2011
MusicBDify

awesome awesome awesome!! Really good tutorial!! Amazing

19 04 2011
lukie254

@sotvisal7 Just add a @ in front of the variable, it you get a warning error or whatever, that just stops it from displaying the error.

19 04 2011
sotvisal7

Hi… can u help me? i got error in line “Undefined index start variable”
$start = $_GET[‘start’];

19 04 2011
samiwistler

Cool tutorial, thanks

19 04 2011
JmanJam321

@Hitman73094 If someone can send it to me too that would be awesome! 🙂

19 04 2011
JmanJam321

Hi Alex, I just wanted to let you know that your tutorials are fantastic. You make learning php so simple and straight forward. Your scripts are very practical and for that i salute you. If i may I would like to make a request. Would it be possible for you to combine the pagination tutorial with the search engine tutorial. It would be very useful to display a certain number of results per page. Thanks in advance, and thank you for the great work it’s appreciated. 🙂

19 04 2011
MrPignati

this would be enough for counting all records (and a bit faster):
$record_count = mysql_num_rows(mysql_query(“SELECT `id` FROM `data`”));

or one could perfom the counting within sql itself:
$record_count = mysql_query(“SELECT COUNT(`id`) FROM `data`);

great tutorial, i just subscribed, great inspiration!

19 04 2011
zauii89

Thanks a lot mate, helped me out for now

19 04 2011
karoletoledo

My name is Mike from LA Although there busizz4me.info

19 04 2011
gervic23

please discuss how to make php search engine with pagination. thanks!

19 04 2011
LukeSambrooks1

is this done the same way you would do a blog. ie submiting pages and most recent 5 posts displayed???

19 04 2011
SRecordsdottk

Why is your cursor always indicating that your PC is loading.. LOL
Nice tutorial thought

19 04 2011
manksa202

it is helpful, thank you man.

19 04 2011
zerqs

amazing! love your tutorials salutes from Norway




%d bloggers like this: