LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-16-2004, 04:18 AM   #1
rmanocha
Member
 
Registered: Oct 2003
Location: Austin,TX
Distribution: Debian SID-->fully content-->Love APT,kernel 2.6.4
Posts: 327

Rep: Reputation: 30
PHP session variables in a database


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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Are PHP session variables held in memory when you leave a PHP site? Locura Programming 11 11-16-2008 08:37 PM
session variables not preserved when navigating thru links prabhatsoni Linux - Software 2 06-13-2005 01:15 AM
php: session variables lost while redirecting appas Programming 2 10-13-2004 09:18 AM
PHP:Unable to post variables from html form to mysql database vikram_cvk Linux - Software 1 09-29-2004 03:01 PM
How to use session variables in perl ? taqs Programming 1 09-28-2004 06:12 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration