hey guys,
I have been witing a search engine in PHP for our companies intranet. I am using session variables to store all my information. It has been working fine while i was saving all the information in files in /tmp on my server.
However I now want to store all the information on my mysql database. I googled around and found this link:
http://www.tek-tips.com/gfaqs.cfm/pid/434/fid/2037
I basically cut and copy the code. I now include this file into my main search script.
the probelm arising is something like this:
The first time when a user comes to the site...he/she gets a new session variable assigned to them and the search works just fine.
However, if they want to search something else, the new search keyword is not written into the database, and the previous word is searched for again.
In other words the database is not updated with the new search word. I echo out the query being sent to the database in sess_write...and there i see that the word indeed is not being updated.
The way i have my search script working is that i use states in the script. The first state is just to display the form, the second to calculate the no. of results i willl have and the third to actually query the database and display the results.
I insert the new data into the session variable in state two(the form uses post).
I check $_SESSION['search'] after inserting the new post data into it and it shows up just fine(the new word is in the variable).
but then as i told you, the search still displays the previous keyword.
The interesting bit is that this function works just fine the first time someone comes to the site....but not thereafter.
I don't know is I have explained my situation well enough here. Please try to help me in ne case.
Thanks