Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 561653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:28:20+00:00 2026-05-13T12:28:20+00:00

Im trying to implement pagination using multiple searching criteria. Supposed I Have student table.

  • 0

Im trying to implement pagination using multiple searching criteria.
Supposed I Have student table. I also use pagination when the list of student displayed.
The pagination link is. site_url . '/student/page/'; so I use $config['uri_segment'] = 1;
so the pagination link will be

<a href="http://mysite/index.php/student/page/0">1</a>
<a href="http://mysite/index.php/student/page/1">2</a>

and son.

After that I wanna search student data using 3 searching criteria implemented using textfield.

id  name    address.

user can search by id or name or address or combination of the three criteria.
the url become

http://mysite/index.php/student/page/0
href=http://mysite/index.php/student/page/1

and son.

but I use get method for searching. and while trying to search using the search criteria field the url become

href="http://mysite/index.php/student/page/1?id=1&name=a&address=b

the problem occurred when I try create pagination based on criteria. because the pagination link have contain query string
i don’t know how to create become

href="http://mysite/index.php/student/page/0?id=1&name=a&address=b
href="http://mysite/index.php/student/page/1?id=1&name=a&address=b

or do you have a best practice to solve this problem ?


Hi phill ….
I have try your suggestion.

$array = array('id' => '001', 'name' => 'a', 'address' => 'canada');

the url become
id/001/name/a/address/canada. I use $this->uri->uri_to_assoc() function to get key and value of the segment.

array (
    id => 001,
    name=>a,
    address=>canada
)

but while there some searching criteria that not included while searching. let say, the user only search by name and address. the array become
$array = array('id' => '', 'name' => 'a', 'address' => 'canada'); and the url id/name/a/address/canada
the assoc array become

array (
    id => name,
    a=>address,
    canada=>
)

the assoc array is not disorganized again. so I can’t get the right value of the assoc array.
I think i will set the identifier to the searching criteria if not included. supposed i put #.

if isset($_GET['id']) then
$id = '#'
else 
$id = $_GET['id']

$array = array('id' => $id, 'name' => 'a', 'address' => 'canada');

How about that … ? or if there are another best practice ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T12:28:20+00:00Added an answer on May 13, 2026 at 12:28 pm

    For that I would use $this->uri->uri_to_assoc():

    index.php/user/search/name/joe/location/UK/gender/male

    Using this function you can turn the
    URI into an associative array with
    this prototype:

    [array]
    (
        'name' => 'joe'
        'location' => 'UK'
        'gender' => 'male'
    )
    

    See the full documentation here.

    You can still use page/1 as the first lot then have /name/whatever afterwards.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.