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

  • Home
  • SEARCH
  • 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 8339353
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:51:47+00:00 2026-06-09T04:51:47+00:00

I have small problem. I’ve coded a full website in php using CodeIgniter framework.

  • 0

I have small problem.

I’ve coded a full website in php using CodeIgniter framework. One of my modules is search module, it contains text input with keyword and three select lists with filtering criterias.

That’s ok, when I’m searching something – result’s listing pagination is done via URL like that:

mysite.com/$keyword/$criteria1/$criteria2/$criteria3/$offset

works like a charm.

But when I’m entering into one of my images (it’s image gallery) I want to have an option to go into NEXT and PREVIOUS image from my search results – the ones which I entered this image from.

I’m solving this case now in this way – I have session table called ‘search_conditions’ and I’m storing values of keyword and my three criterias there, but that’s quite not comfortable, because why if someone opens second window and search something else there?

Then all of his searches in another windows or tabs are getting the same criteria – because with every new search, user overwrite the session value.

My next and previous functions:

public function next($count)
{
    $search = $this->session->userdata('search_conditions'); //getting session table and overwriting it

    $catid = isset($search['catid'])?$search['catid']:'0';
    $brandid = isset($search['brandid'])?$search['brandid']:'0';
    $prodid = isset($search['prodid'])?$search['prodid']:'0';
    $keyword = isset($search['keyword'])?$search['keyword']:'';

    $res = $this->search_model->main_search($keyword,  $catid, $brandid, $prodid, $count, 1);       
}



public function previous($count)
{
    $search = $this->session->userdata('search_conditions');

    $catid = isset($search['catid'])?$search['catid']:'0';
    $brandid = isset($search['brandid'])?$search['brandid']:'0';
    $prodid = isset($search['prodid'])?$search['prodid']:'0';
    $keyword = isset($search['keyword'])?$search['keyword']:'';

    $res = $this->search_model->main_search($keyword,  $catid, $brandid, $prodid, $count-2, 1);     

}

Can you recommend me some other, more comfortable solution, because this seems not to be good…
: )

Thank you!

  • 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-06-09T04:51:48+00:00Added an answer on June 9, 2026 at 4:51 am

    Add an index to the $search_conditions variable:

    $search_conditions[1]['catid']
    $search_conditions[1]['brandid']
    ...
    

    then refer to it with a controller’s or config variable. This way you can allow one session to store multiple search conditions.

    But I would recommend you drop storing the search condition in session. Instead, just pass it with the URI. Session data, in the case you describe, work as an intermediary; you don’t need it. Use the Pagination Class and pass the search page number, not the direction (next or previous) to the URI.
    Do not worry that the URI may look ugly – it only depends on what user searches for, and it’s still friendly to share. Your only concern is if the GET string does not extend the limited length.

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

Sidebar

Related Questions

i have a small problem with a jquery click trigger. in my index.php i
I am generating new xml file using perl script but I have small problem,
I have a small problem with the UITableviewCell. i'm using the code: UIView *cellBackView
I have a small problem by using PDO instead of mysql_fetch_object . I tried
I have a small problem trying to unzip a file using the 7za command-line
I have a small problem on a website with a background element in CSS
i have small problem i.e. their is one celltable with lot of data it
I have small problem with name spaces in php 5.3. I've made declaration for
I have one small problem regarding MPMoviePlayerController, i have a link that play movie
I have a small programming problem (php & javascript). On index.php page I'm printing

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.