/    Sign up×
Community /Pin to ProfileBookmark

Session, or DB search?

Would it be better to search the database one time, and save all the information into sessions (when a user logs in), or just search the database everytime, and use something like [B]$row[‘column_name’][/B] after you fetch the array.

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@NogDogNov 04.2006 — I'd probably go with the session option, but reserve the right to change my mind depending on what the actual specifics are of your situation.
Copy linkTweet thisAlerts:
@The_Little_GuyauthorNov 04.2006 — Here is what I have in mind... When the user signs in, it takes them to their "Main page" where they get all the user options. They can choose to upload images 20-50 I haven't decided, these will be displayed in their portfolio, which they can edit using HTML, and CSS to make their own design.

What would be stored in the sessions:

- an array of image file names

- an array of other file names (I don't know if I'll need this or not but just in case)

- user name

- user password

- logged in or out

- user id number (auto increment in D?

- first name

- last name (maybe)

The reason I ask this question is for storing the image file names in sessions I was thinking that this way would be faster than searching the DB everytime the user views his/her images, but instead search the DB once for the images. if the user uploads new images, it would add them to the session array, and if they delete image, it would remove them from the session array.
×

Success!

Help @The_Little_Guy spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...