Thread: php sessions
View Single Post
Old 10-09-2007, 02:21 PM   #13 (permalink)
Rating: 0% (0)
Matthew King
Advancing Real Estate agent
 
Matthew King's Avatar
 
Join Date: Jul 2007
Posts: 95
Default

By row, I assume that you mean database row? If you want to store these in the database, then you don't need to be keeping them in the session. Instead your add.php would be something like this:

Code:
session_start();

// open your db connection here

// put together sql string
$sql = 'INSERT INTO portfolio (session_id, reference) VALUES (\'' . session_id() . '\','\' . mysql_real_escape_string($_GET['reference']) . '\';

// execute the sql

// redirect user
Then on your portfolio page, execute this:

Code:
   'SELECT reference FROM portfolio WHERE session_id = ' . session_id();
That will still only last for the length of the session though (about 20 minutes after inactivity, so alone - there's no point in storing it in the database. You'd probably want to give the user the opportunity to save their portfolio before they leave, by entering their email address. Then you can do this:

Code:
   'INSERT INTO portfolio_owner (session_id, email) VALUES (\'' . session_id() . '\',\'' . mysql_real_escape_string($_POST['email']) . '\'';
Then their portfolio can always be found again when they enter their email address. Now this is gradually getting more complicated, but thats how things go.

Best of luck.
__________________
Real Estate Web Developer & SEO Consultant

www.costablancapropertyportal.com | Costa Blanca Property | Javea Property for sale
Matthew King is offline   Reply With Quote
 

Spanish Real Estate Forum - Members newest adverts
A Castle in Spain
Costa Azahar Village House for sale
CHL Investment Opportunity Coasta Azahar
Cervera del Maestre Property
S01 New Villas Costa Azahar