Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1

    Default How do I number my search results (1,2,3)?


    I have this php page that displays all the record from the database.
    now, I want them to look something like this..

    1. result A

    2. result B

    3. result C

    There's a lot of records in my database, so it has several pages.(each page displays 20 records)

    now if i go from page 1 to 2 to 3 to 4 ....if its increasing. the numbers shown are correct.
    but if i go from page 2 to 1, or from page 5 to 1 the numbering is wrong.


    Google use to have numbered search results but its gone now, so I got no reference.
    That's what I want to achieve.

    Please help. thank you.

  2. #2
    Use the pagination algorithm

    **Before doing so, use COUNT() the first query to count all records. Only use this to get the numbers for preparation only for your algorithm. Only used to calculate TOTAL pages.

    **Second query, Use LIMIT query at the end.
    if you got 20 records per page. Create an algorithm to do this.
    Page 1 --> LIMIT 0, 20;
    Page 2 --> LIMIT 20, 20;
    Page 3 --> LIMIT 40, 20;
    Page 4 --> LIMIT 60, 20;
    Page 5 --> LIMIT 80, 20;
    and so forth..... 20 records interval until to the LAST PAGE calculated.

    Code:
       $interval =  ($input-1) *20;   
    
    To solve for page 1:    answer is 0
    To solve for page 5:    answer is 80
    To put it simply.... you should make your queries dynamic too, not only the result. Are you using PHPMYADMIN? You should see that coming, the BIG EXAMPLE is just under your nose. You're clicking "next pages" with that application, you could see PHPMYADMIN handle it!!!

    rock on dude!!!
    Last edited by dodie; 06-20-2010 at 12:12 AM.

  3. #3
    waaaa...superrr supeerrrr.....thank you <3
    naa namai limit and all ako page. but i didn't realize i could use it for the numbering..wahahah...thank you so so soooo much! you really halped me ^____^

  4. #4
    Or you can use JQuery w/ tablesorter plugin - mas simple:

    jQuery plugin: Tablesorter 2.0

    jQuery plugin: Tablesorter 2.0 - Pager plugin

  5. #5
    it's about solving, not adding plugins. uggh.
    It's about proper execution of extracting data without wasting extra resource that are not used in the SELECT statement. Strictly apply it on a SQL query, simple as that.

    You can't satisfy CUSTOMIZED systems if you always depend on extra systems. If you do that, you're just a USER, NOT a programmer.
    Last edited by dodie; 06-21-2010 at 11:14 PM.

  6. #6
    patay nag lagot si sir dodie >.<
    don't worry. if mag apply man sad ko ug other system sabtun man sad nako ang code.
    but with my paging. paging rajud to. no more no less. ^^

    @maddox; thnx sa pag share ^^

  7. #7
    Elite Member
    Join Date
    Aug 2008
    Posts
    1,053
    Blog Entries
    1
    hahahahahaha.... if you're not a USER, then probably is a DRUG DEALER? hahahaha ang init ng mga ulo ngaun. tapos na ang summer ah. hehehe

  8. #8
    kalma lang mga guys

  9. #9
    Elite Member
    Join Date
    Jun 2010
    Gender
    Male
    Posts
    1,018
    @dodie

    I think you are taking customized too literally.

    The application, or the system for whatever you use it for, is customized for the client's needs.

    You don't make it less customized just because you are using tools, plugins, APIs, libraries or the like.

    But you have a point when you say that if you always depend on extra systems, you're just a USER, NOT a programmer.

    But I cannot fathom how we are able to use these systems if you don't have enough skills as a programmer.

    Besides why write code that has already been written.

    But to the many "users" make an effort of understanding how these plug-ins work.

    It will be a win-win situation by then.

    Peace.

  10. #10
    @Klave,
    It doesn't change the fact that you can't satisfy the customized system created, sometimes plugins are not useful. Think twice.

    1st.
    Can you solve C-chan's problem without using any plugins?

    2nd
    How C-chan improve without solving that problem herself?

    3rd
    Can C-chan become a great programmer is she always use plugins?
    ------------------
    You don't need to answer these questions in this thread......... All I can say is IMPROVISE.
    Last edited by dodie; 07-03-2010 at 09:28 AM.

  11.    Advertisement

Page 1 of 2 12 LastLast

Similar Threads

 
  1. how do i conquer my doubt???
    By mhai...07 in forum "Love is..."
    Replies: 48
    Last Post: 08-09-2011, 11:13 AM
  2. how do i view my posts??
    By ako_si_dave in forum Support Center
    Replies: 17
    Last Post: 06-12-2008, 09:23 PM
  3. Help: How do I install my 2nd HDD?
    By alviperz in forum Computer Hardware
    Replies: 15
    Last Post: 01-21-2008, 09:29 AM
  4. How do i check my processor, if overheating or not?
    By HLadik2 in forum Computer Hardware
    Replies: 25
    Last Post: 11-08-2006, 12:43 PM
  5. How do you personalize your searches?
    By ajpyoung in forum Support Center
    Replies: 0
    Last Post: 06-25-2005, 08:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top