PHP Pagination Tutorial MySQLi Google Style Paged Results Programming

Поділитися
Вставка
  • Опубліковано 16 вер 2024
  • Code: www.adamkhoury...
    Learn to script pagination for PHP and MySQLi based web applications. Use pagination programming when your database table has a lot of rows and you do not want all results to render on a single page.

КОМЕНТАРІ • 192

  • @lovekushtari
    @lovekushtari 2 роки тому +2

    Its been 8 years, i am still fan of this video.

  • @talimagnum
    @talimagnum 5 років тому +6

    2019 and you are still helping me! thanks a lot

  • @GillesBeaulacJoe
    @GillesBeaulacJoe 9 років тому +3

    Keep 'em coming Adam!
    Thanks for these awesome tutorials!

  • @omarykijogoo9216
    @omarykijogoo9216 3 роки тому +1

    This tutorial very helped me thank you a lot Sr. Adam. Blessed to you..

  • @craigjones5232
    @craigjones5232 8 років тому

    Adam, we've spoken before - I'm a big fan of your work & you've taught me a lot! I'd love you to do a summary at the start of each video of all the steps involved in a process. Many thanks for all your hard work, its much appreciated.

  • @dokutes
    @dokutes 9 років тому

    I tried to figure out myself how the make the script work. Its to complicated. Thanks a lot. A big like.

  • @bluecafe509
    @bluecafe509 11 років тому

    I always laugh at least once when I watch your tuts.
    You're always on the pulse of what people want to know.
    You the man. :-)

  • @AdamKhoury
    @AdamKhoury  11 років тому +11

    PHP Pagination Tutorial MySQLi Google Style Paged Results Programming

    • @EAGLE777999
      @EAGLE777999 11 років тому

      HELP, HELP, HELP Please...
      Hi Guys.( This project has been on my laptop before even Groupon launched their web site!).
      I need your advice and Welcome your suggestions on this Project that has been on my mind for years but can't find the right experts to develop it with in the budget i have! Any suggestions Please?
      Below a brief descriptions:
      Looking to develop a GROUPON-Like Web Site But not Clone.
      Document Intent:
      The purpose of this document is to communicate the understanding of the project requirements and tasks for the Groupon , Eversave, and Livingsocial like website. One thing must be kept in mind is that this is not a clone site.
      The site project will have many similarities to daily deals web sites like Groupon, SCOUTMOB, and Livingsocial.
      It will have several aspects of user interfaces for the admin, the sales personnel, and the end user. Each user interface will be designed to make it as easy as possible to maintain a straightforward look and feel.
      1. The site cannot be from a template already available on the Internet
      2. The site must be easy to navigate
      3. Google Search Engine Optimization (SEO) is a MUST
      4. The site must contain a section to change the look and feel (Templates)
      5. The site must be customizable to the end user
      6. It must handle a heavy traffic without crashing
      7. PHP is the preferred language
      8. The site must contain high security for secured transactions.
      9. NO BACK DOOR ACCESS CODE OR SQL INJECTION WILL BE ALLOWED
      10. NO RIGHTLICKING TO COPY ANY CONTENT OF ANY PAGES WILL BE ALLOWED. ALL IMAGES AND COPYRIGHT CONTENT MUST HAVE A WATERMARK/HIGHER SECURITY CODING
      11. The site must have a fail-over server so it can handle the amount of traffic which will be anticipated
      12. This development must free from Bugs.
      13-Highest quality clean coding is a Must
      IMPORTANT:
      This site should be designed from the ground up using latest PHP and MYSQL. (We welcome your suggestions) There will be no third part designs allowed. The only third party applications which will be tolerated are ones that would be used as modules to help improve the site, however, there should be no visible references pointing back to the original designing party; moreover
      We will have ownership of all the proprietary code implemented.
      Front End:
      Once the user visits the website the user can get the suggested city deal from the IP address tracked by our system, or if required, the user can change the location manually by selecting the city from the list of given cities and Category. The system must also collect their email address, gender, and other basic information.
      The front Page
      The front page will feature random or main deals of the day for the visitors' current location; however, once a user selects or views a deal, the system should track the consumer search behavior and suggest deals according to that particular user's behavior.
      The user will then be able to customize his or her page to showcase different deal categories as either a toolbar or a dashboard according to their interests. If possible, the user will be able to customize the page without becoming a registered member. The system should already know the user based on the email address provided when first visited the site.
      The web development should also include the Web Design (The overall look and feel) Wireframes/Mock-up’s Graphics, etc. We already have the Home Page illustration as an Idea/ Visualization for Brainstorming design for the Top home page and the Story-Board is done but we need Animation plus the Logo But both will need editing...
      Regards-Cody

    • @idieatesports4473
      @idieatesports4473 9 років тому

      Hello Adam, thanks for your script. it works like a charm however I'm still contemplating on how i can embed it with a search property. Any assistance you extend to me will highly be appreciated.

    • @idieatesports4473
      @idieatesports4473 9 років тому

      Birimuye Gideon I fixed it after a long time of revision. It now runs perfectly well.

    • @ronnymax9466
      @ronnymax9466 8 років тому

      +Birimuye Gideon pls help brother how did u fix that

    • @Leilektsoglou
      @Leilektsoglou 7 років тому

      Can you send me the revised code? leilektsoglou@gmail.com
      Thank you in advance.

  • @AnkleshChauhan
    @AnkleshChauhan 10 років тому +1

    thankYooo very much : ) explained very well and working nice for me.

  • @TundeOgunjimi
    @TundeOgunjimi 6 років тому

    Thanks Adam. Worked as expected. Couldn't figure out how to do this on my own.

  • @oldguy8177able
    @oldguy8177able 2 роки тому

    used my own code with yours it works,thank you for doing youtube video ,a big help.

  • @opakiriteibama1201
    @opakiriteibama1201 11 років тому

    Your tutorials are great inspirations to me, because your styles are marvelous.

  • @JohnMc10
    @JohnMc10 10 років тому

    Another awesome and very well explained tutorial. Thanks Adam, it works perfect.

  • @makaveli4244
    @makaveli4244 5 років тому +1

    Thank you so much! I finally can make a proper php pagination.

  • @talaanngkakaiba2951
    @talaanngkakaiba2951 7 років тому

    Not the ordinary tutorial guy LOOL .. informative and entertaining haha

  • @skyangels6816
    @skyangels6816 9 років тому +3

    I am one of biggest fan of you now ADAM :p
    unfortunately I was trying to add this to my mysqli based search I tried hell lot but could not work out,
    So I gave up to add this to my search results, if you could help me to show how to integrate this to a search results based pagination It will a big favor for me, please please do it if you can :D pleaseeeee I request you a lot :p

  • @michaeljosephdavis
    @michaeljosephdavis 11 років тому

    Awesome lesson on Pagination. I would like to see an ajax pagination tutorial also. I have pagination on my web site and I added ajax so it would paginate without refresh or leaving the index page, but it did not work. It would show the first page but when you click to go to the next page it would leave the index page and go to the products page. So I got rid of the ajax and just went with php coding and it works good. So please teach us the ajax pagination . Thanks ADAM

  • @bluescanfly1981
    @bluescanfly1981 11 років тому

    you can use intval($pagenum) instead of the preg_replace
    if it's not parsable it will return 0. Good stuff as usual

  • @SuryaAkasam
    @SuryaAkasam 10 років тому

    Very informative. Thanks very much for sharing.

  • @Osazee989
    @Osazee989 11 років тому

    Adams, you are the best

  • @lesliew.6053
    @lesliew.6053 8 років тому

    Awesome video Adam!

  • @kavindasupun7860
    @kavindasupun7860 6 років тому

    Thank You ... Nice lesson ... fully work code..

  • @bobocris1
    @bobocris1 8 років тому

    you are the best.great work

  • @DIEUXDELAPAIX
    @DIEUXDELAPAIX 8 років тому

    I never remember the name of things, after hear you the first 3 seconds of the video I will always remember. Thanks

  • @daniloparra5609
    @daniloparra5609 8 років тому +3

    Thank you very much Adam! This helps a lot for beginners like me!
    I encounter a problem with regards to $limit variable
    $limit = 'LIMIT' .($pagenum - 1) * $page_rows.','.$page_rows;
    $sql = "SELECT id,firstname,middlename,lastname FROM `members` order by id DESC $limit";
    coz its making my sql some errors so I try to do this instead and it works fantastic now
    $para = ($pagenum - 1) * $page_rows;
    $sql = "SELECT id,firstname,middlename,lastname FROM `members` order by id DESC LIMIT $para,$page_rows";
    right now I'm trying to combine the pagination to a search function.

  • @theinvestigatorx
    @theinvestigatorx 11 років тому

    Fantastic Tutorial with humor

  • @ufeyncom
    @ufeyncom 6 років тому

    Great resource & excellent demonstration methodology.

  • @raymondotto1828
    @raymondotto1828 11 років тому

    Adam brilliant tuts bro. I am really improving with my skills by learning from you. How do we donate to you guys? You got paypal account? I can't keep learning brilliant stuff without contributing something. You guys are just awesome...

  • @SynTax761
    @SynTax761 11 років тому

    nice tutorial again adam..your the men:)

  • @HeinzNieveler-hnVideo
    @HeinzNieveler-hnVideo 5 років тому

    Very useful for me, I finally understood that. Thenk U very much!

  • @devchollo4043
    @devchollo4043 4 роки тому

    awesome teaching skills

  • @GAllanRoberts
    @GAllanRoberts 11 років тому

    Ajax it awesome tut I never got this deep into page nation before

  • @robertwainaina1491
    @robertwainaina1491 8 років тому

    thanks Adam for it.Great!

  • @mamdouhzaq
    @mamdouhzaq 11 років тому

    Another great tutorial. Thank you

  • @kamaboko1
    @kamaboko1 9 років тому

    Fantastic tutorial.

  • @toms900
    @toms900 11 років тому

    Awesome tutorial as usual! Ajax pagination would also be really nice!

  • @gabrielnunez4843
    @gabrielnunez4843 10 років тому +1

    I can get this to work, i just wish I understood it better. I don't really understand starting at 5:41 when he starts talking about URL var "pn". He is saying pagenum from "URL vars" but I don't know what that means and google is no help so far. I see that $pagenum is linked to pn via GET, however, I don't see how either of those are tied to the set of rows established by the query. Is pn some kind of http/GET topic not covered in this tutorial? Can someone please answer if they know the question? To restate my question, I do understand how the URL is passed a value for pn, however, I do not understand why setting pn to a certain number limits the results you see to a set range of rows.

  • @lumo-lm
    @lumo-lm 8 років тому

    Great stuff!
    Tip for someone looking for a WordPress solution: instead of $_SERVER['PHP_SELF'] (or $_SERVER['REQUEST_URI']) you can use the_permalink()

  • @sebastianpalma5051
    @sebastianpalma5051 9 років тому

    Thanks professor!

  • @reymago23
    @reymago23 6 років тому

    this tutorial was very nice, well explained, thank you Adam boy.

  • @alifiasyalsabila3001
    @alifiasyalsabila3001 8 років тому

    thank you this code is help me so much eventough at first i fell a bit confused

  • @YassineRafrafi
    @YassineRafrafi 11 років тому

    Awesome tutorial

  • @andrestrujillo
    @andrestrujillo 11 років тому

    Yes!!!!! I have looked everywhere!!!! I love it face!!! Pagination Pagination Pagination Pagination Pagination

  • @duartelourenzo
    @duartelourenzo 11 років тому

    Thank you so very much for this tutorial!
    You explain very well!

  • @truth6415
    @truth6415 10 років тому +2

    hey is it ok if i use
    $pagenum = (int)$_GET['pn']; This will also convert string to number
    Instead of preg_replace function at 6:27

  • @JTvid
    @JTvid 11 років тому

    Hi Adam, I can't wait to learn how to make ajax pagination like facebook and twitter.

  • @VilyaLsCpt
    @VilyaLsCpt 9 років тому

    YES! Thank you very very much! You did a great job at explaining everything :)

  • @BinaryGear
    @BinaryGear 8 місяців тому +1

    Fantastic tutorial! Very well explained! This video however is 10 years old, are there any changes I'll need to make to my code in order to make this work (I'm using php 8)?

    • @AdamKhoury
      @AdamKhoury  7 місяців тому

      Thanks. The MySQLi will hold up for a good long time to come. One can consider using PDO prepared statements for the queries since many are using that for its built-in input sanitizing feature, but I personally enjoy having control over what to strip out or convert out of any data(variables) that may be put into a query. Also consider creating a PHP class file(OOP) for all database interactions in a project. That way if you ever decide to change database tech from MySQL DB to say MongoDB or any other, nothing would need be updated in your project files, just update the single class file. Also handy for when PHP deprecates mysqli in the future whenever/if they decide to.

    • @AdamKhoury
      @AdamKhoury  7 місяців тому

      For the rest of the PHP code, I am not sure, there could be a deprecated function or two. If you have error logging enabled for PHP on your server, PHP will tell you if anything in the code requires an update. Sometimes the error logging will also tell the programmer what function to switch to.

  • @isunas16
    @isunas16 9 років тому

    great job bro....

  • @roinomade
    @roinomade 5 років тому

    Great job! thanks

  • @Yorgarazgreece
    @Yorgarazgreece 10 років тому

    hey adam!
    nice tutorial really helped me figure how pagination works.
    i tried to use your code to my project but it was getting wrong number of rows so instead of getting the row from the mysqli_fetch_row why you can just get them by calling mysqli_num_rows(the query php var here).
    thanks again for this nice tutorial!

  • @Ostrogotsky
    @Ostrogotsky 9 років тому

    Adam, thank you for the video. Helps a lot.

  • @AdnanKabbani
    @AdnanKabbani 10 років тому

    Very useful thank you , !

  • @AmranurRahmanchobi
    @AmranurRahmanchobi 5 років тому

    this is Awesome ..

  • @jessica_kate_
    @jessica_kate_ 7 років тому +8

    He Sounds like Mafia thug.. WOW!

    • @jameswalker231
      @jameswalker231 7 років тому

      lol was thinkin the same... thought i got the wrong guy... lol

  • @jimrush72
    @jimrush72 11 років тому

    Yeah, let's have the ajax pagination tutorial too.

  • @chickenwriter
    @chickenwriter 11 років тому

    Hey thanks... I had forgot how to do that. I keep going back and forth between asp and php, so forget the syntax and have to look it up. :-)

  • @MrWasim100100
    @MrWasim100100 10 років тому

    thanks you explained well about mysqli_connection.php, mySQL query, logic behind pagination and while loop even the css used but what about testimonials.php will it be created as the program starts running on server

  • @Echo442Studios
    @Echo442Studios 11 років тому

    great Tutorial

  • @TomSimpson4
    @TomSimpson4 10 років тому

    Well done! Thank you Adam.

  • @konkanibluffer3529
    @konkanibluffer3529 6 років тому

    awesome tutorial. Thank you so much sir, God bless You.

  • @saipranaynandagiri3581
    @saipranaynandagiri3581 8 років тому

    have done tutorials for JSP in the same way that u did for PHP. If not plz do on JSP also.

  • @websachi
    @websachi 8 років тому

    This is a Great Video Tutorial, thanks so much.

  • @I3B13
    @I3B13 11 років тому

    Actually you can use && in the for loop like this "for($i = $pagenum+1; $i

  • @1111TP1111
    @1111TP1111 11 років тому

    Great tutorial. Thank you so much. If you had time to do PHP/Ajax pagination than it would be really GREAT!!! Masterpiece as always :D

  • @shahidmuneer95
    @shahidmuneer95 7 років тому

    thanks a lot man you are great ! its really simple method you are really really very very great

  • @Rambroo92
    @Rambroo92 11 років тому

    Just what I have been looking for.. Thanks :)

  • @cristianavalos5466
    @cristianavalos5466 9 років тому

    You saved my day. Thanks!!!

  • @86angeline
    @86angeline 8 років тому

    Perfect!
    Thank you for the tutorial !!

  • @hellelo.5840
    @hellelo.5840 5 років тому

    Good Programming Habits :)

  • @travisgreer4142
    @travisgreer4142 8 років тому +1

    Thank You. This helped a lot.

  • @RakshitaKaulgud93
    @RakshitaKaulgud93 10 років тому

    Hey , nice tutorial. Thank you. Looking forward for more :)

  • @roseliux
    @roseliux 10 років тому

    thanks for your help.

  • @sportnastava
    @sportnastava 8 років тому

    Hi, this is super nice tutorial, can you show us how to make "sort/order by" data thingy with pagination? I tried several things and can't make it work Q.Q at the moment i'm using resaved file and in files for sort i change ASC/DESC thing, its super lame and would like to learn how to do this proper way.

  • @simonlawrence7994
    @simonlawrence7994 9 років тому

    I would like to see a video on how you go about creating the database

  • @SaifulIslam-ns6bi
    @SaifulIslam-ns6bi 11 років тому

    Hi! Adam thanks for your useful tutorials. i was making a photo gallery with javascript but i had a problem to keep the photo's original width with specified height. If you can help me please .. it would be so helpful for me.. thanks again ...

  • @petruciucur
    @petruciucur 5 років тому

    Very efficient, thanks a lot !
    Have a question: In what situation can be $last_page < 1 ?
    If there are records in database, php ceil() rounds any fraction so, anytime will be a positive number.

  • @llaazzmm666
    @llaazzmm666 6 років тому

    THANK YOU SO MUCH!

  • @nplusplusstudios7247
    @nplusplusstudios7247 10 років тому

    thanks a lot for this script. you've done a wonderful job, have a nice day ... :) cheers

  • @dziedzormadapoe5421
    @dziedzormadapoe5421 8 років тому

    thank you for your tutorial it helped me out alot

  • @JitendraKumar-sd9wv
    @JitendraKumar-sd9wv 7 років тому

    great great great..................................i have no words to thank you. i need exactly this kind of paging. i have searched more but i get nothing. thank you very much. will you please upload a video without changing url variable value. because i am using ajax and jquery. this is great tutorial for me, but it refresh browser.

  • @fakevideos6681
    @fakevideos6681 7 років тому

    undefined variable db_conx line 7 mysqli_query() expects parameter 1 to be mysqli, null given mysqli_fetch_row() expects parameter 1 to be mysqli_result mysqli_fetch_array() expects parameter 1 to be mysqli_result mysqli_close() expects parameter 1 to be mysqli

  • @Chim
    @Chim 9 років тому

    You did an amazing job at explaining everything in this video and I applaud you as I was able to make my first Pagination Pages on a website project I am working on at the moment. I do however have some advice. I changed the PHP_SELF tag to use $_SERVER['REQUEST_URI'] as I needed to carry over some URI Variables. Just aheads up if anyone wants to retain your variables. :)

  • @TheNoobchat
    @TheNoobchat 11 років тому

    In your video "1/6 - Web Intersect Friend Add System Tutorial" I have got the interaction box but I dont think my page knows the difference between session id and id. How do I differentiate them so it works like in your video?
    At the moment I do not see the "Add friend" option, just the own profile option or signed out option.

  • @benbilllen749
    @benbilllen749 8 років тому

    how would one integrate a javascript powered onscroll dynamic content loader with this pagination concept like you showed in your other video?

  • @kevinrodriguez3174
    @kevinrodriguez3174 7 років тому

    Very helpful, thanks a lot

  • @abed-alansari
    @abed-alansari 9 років тому

    Great, thanks :)

  • @collinrobinson3565
    @collinrobinson3565 11 років тому

    thank you great tuloria
    l

  • @Krisstoof1
    @Krisstoof1 8 років тому

    Thank you for this tutorial.

  • @denisaprofir
    @denisaprofir 9 років тому +2

    thank you :) You saved the day... :)

  •  11 років тому

    how can i use twourl encoding types for example if im on a pm inbox using u?= and also pn?= at the same time how can i do this?

  • @ShabbirLokant
    @ShabbirLokant 7 років тому

    hello excellent video
    I am have a query
    I need to add style to active page in pagination

  • @heyyy4987
    @heyyy4987 8 років тому

    i would like create a pagination in decades 1970-1980 | 1980-1990 | etc How we do that
    ?

  • @DashcamReport
    @DashcamReport 6 років тому

    Great tutorial!

  • @rnc1931
    @rnc1931 5 років тому

    thanks a lot my dude

  • @TankiHeroPlayer
    @TankiHeroPlayer 11 років тому

    Can you make a tutorial in flash cc professional, how to make a simple email form with a movieclip button and textfieldinput.

  • @adriannlara
    @adriannlara 11 років тому

    sos un genio ;)

  • @seanpeoples8061
    @seanpeoples8061 10 років тому

    Hi Adam, great tutorial! I just have one question, I'm trying to display the results of a tournament on a page. For example, I want the gameweek 1 results on page one, gameweek 2 results on page two etc. I tried to follow this the same way but i couldn't get it working correctly, any tips?

  • @Osazee989
    @Osazee989 11 років тому

    please go ahead with the Ajax pagination, I need it thanks

  • @bensoi
    @bensoi 10 років тому

    hi. i got the code to work using my own database.. However, I want to place each data inside a table. how do i do that? change the html_output by placing each itemArray inside a tr/td tag? Nice video btw