Reply to Re: SESSIONS

Your name:

Reply:


Posted by Jerry Stuckle on 05/08/06 18:26

jantox@gmail.com wrote:
> Good day,
>
> We have some Java programmers in our software dev, and they are
> pressuring us to use Sessions to store data and use that Session to get
> query data. They say that it is ok since it is like Entities in Java. I
> am baffled as a .NET programmer, we tend to avoid using sessions and
> instead use DataSet, is there any equivalent of dataset in PHP?
>

One thing to remember is with PHP information does not survive the page unless
it is stored externally.

Sessions are a very convenient and safe way to store the data. Data is stored
locally on the server and only the session ID is stored in the client's browser.
PHP handles the sessions quite well; all you need to do is place
session_start() at the beginning of each page where you wish to use sessions.
If no session has been previously started, a new one is created. Otherwise the
existing session is used.

Then you can set and retrieve data from the $_SESSION superglobal array, just
like any other superglobal, i.e.

a.php
session_start();
$_SESSION['counter'] = 1;

b.php
session_start();
$myvar = $_SESSION['counter'];

Quick, easy and convenient.

Now - I wouldn't use sessions to store a megabyte of data or more, because the
entire array would be read into memory. This could cause performance problems.
But if you need to store that much perhaps you need to rethink your structure
a little more. A database might be more reasonable, depending on your needs.





--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация