new_to_php Posted June 26, 2007 Share Posted June 26, 2007 Hi , I am implementing seach functionality in a website. Taking the keyword , search all the pages and storing results in result_array. Results are displayed PAGE WISE. (like PREV 1 2 3 NEXT) If user clicks on "2" I am displaying from result_array[10] to result_array[19] like that. So I took result_array as session variable. session_start(); session_register("result_array"); It is working fine , If I took 2 different browsers and test tha functionality on different browsers. BUT problem is : 1. I open a browser (TAB1), open that website , give a keyword to search. Suppos it showed 30 results in 3 pages ( Prev 1 2 3 Next ) Than , Open new TAB (TAB2) on same browser , open that website , give different keyword for search. suppose it shows 50 results in 5 pages ( Prev 1 2 3 4 5 Next) NOW go to TAB1 .. Here problem comes , when I click on any page (suppose "2") result is over written by TAB2 results. I think it is becaues result_array is taken as session variable , how to solve it ? How to over come this problem. Thank you. Quote Link to comment Share on other sites More sharing options...
Dragen Posted June 26, 2007 Share Posted June 26, 2007 give them unique session names. maybe have the session name so it includes the first keyword, so they can be defined. Quote Link to comment Share on other sites More sharing options...
TreeNode Posted June 26, 2007 Share Posted June 26, 2007 Re-work your logic from the beginning. Your script is working as you made it, session variables are tied to the specific host and computer in which it is calling it, so if another file is outputting session variables that were assigned in a different file, as long as its the same host/client it'll be the same values. One of the ways to fix your problem is to include the searched text on the page tabs, so it re-runs the query for every tab you choose. Or, you could have all of the pages/tabs outputted and you simply use javascript to navigate from one to the other (they would all be parsed out and unchanged that way). Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.