PHP forums, MySQL forums, Web Development resources

Home PageHome    PHP ResourcesTopic List    FAQFAQ    SearchSearch    MemberlistMemberlist    UsergroupsUsergroups 
 RegisterRegister
    ProfileProfile    Log in to check your private messagesLog in to check your private messages    Download the RSS Reader RSS Feed Download the RSS Reader RSS for this forum Log inLog in 

PHP Forum :: MySQL Forum :: Java Script Forum



design and efficiency issues (revisited)

 
Post new topic   Reply to topic    WeberForums.com Forum Index -> Theory related web design
View previous topic :: View next topic  
Author Message
yaniv
Guest





PostPosted: Mon Mar 29, 2004 1:31 am    Post subject: design and efficiency issues (revisited) Reply with quote

Hello,

I just posted this message at PHP forum, but I believe this forum would be more appropriate as to the subject. Please don't suspect me as a forum spammer, it's an hoenst mistake.

My background is unix C++ programming. I started web ( asp :-( ) 6 moth ago.
My NT/IIS/ASP website needs to find a more reliable form of existance if you get what I mean ... the cosen reliable configuration for me is Linux/Apache/PHP.
The need to convert my code from ASP to PHP gave a little hope of coding the right way, when you can use your machines resources and they won't crash or get stuck.
OK - the question :

My application needs session tracking including gathering new data from each new page (input from form, time in page etc). when the user leaves my site, i need to make sure all the set of session data is stored to the DB.
I read a lot about session tracking and all it's possibilities(cookies, URLs, session params etc.). I'm asking efficiency. there are 3 major ways i figure:

*1* store in the $_SESSION all the params I need for the curret session. Is the machine and resources handling in PHP on Linux more stable in the way that I can load 20/30 different parameters on each session ? In ASP the site would crash in a day ... Ofcourse I can build a sessionHandler class and assign it to the session at the begining, would that work ?

*2* Another option is at each page load to save the new gathered data to the DB directly since i can store the session id somewhere . this means establishing connection with DB on each load and saving. I could also save session data on a text (or XML) page and when session ends to dump it to db. problem is calling for resources on EACH page load, good or not ?

*3* what I believe is right, and I did it with my asp code, question is if it's not overshoot: the main HTML page has an inner frame within, thats where the changing content is. I have JS params on the main HTML page(or a handling JS class), and on every reload of the inner frame, i dump the params to the HTML main page JS params. when the session dies, i have on_unload that send the data to the server as inner form data. this way i contact the DB only when the session ends, and still can maintain the data from the session. I can still keep a little general info (like id) on each session using cookies and/or $_SESSION.

So, long question ... but i think it's pretty important ....
there are 3 basic ways to maintain data, which is most efficient in PHP ??? how do resource handling on linux makes the job easier ?

thank you very very much if you got this far in reading .. and thank you even more if you reply :-)
yaniv
Back to top
bastien
Guest





PostPosted: Wed Apr 21, 2004 7:41 pm    Post subject: Re: design and efficiency issues (revisited) Reply with quote

From a personal point of view I prefer to store directly in the db...this will of course depend on various factors but most sites will simply not generate the traffic required to slow down the db server...

But in my case, i find it simpler and more efficient and I won't loose data if there is a browser screw up...

Also, JS is not likely to be on in every computer and as more and more exploits take advatange of JS to download virus' and trojans, its likely that more people will turn it off.

Storing the data in sessions is also an option, but it does increase the load on the server, which is what you were trying to avoid.

Given the speed and flexibility of mysql and php, entering right into the db is, imho, the best way...
Back to top
jezzicaz789



Joined: 22 Feb 2010
Posts: 1

PostPosted: Mon Feb 22, 2010 12:51 pm    Post subject: Re: design and efficiency issues (revisited) Reply with quote

[quote="yaniv"]Hello,

I just posted this message at PHP forum, but I believe this forum would be more appropriate as to the subject. Please don't suspect me as a forum spammer, it's an hoenst mistake.

My background is unix C++ programming. I started web ( asp :-( ) 6 moth ago.
My NT/IIS/ASP website needs to find a more reliable form of existance if you get what I mean ... the cosen reliable configuration for me is Linux/Apache/PHP.
The need to convert my code from ASP to PHP gave a little hope of coding the right way, when you can use your machines resources and they won't crash or get stuck.
OK - the question :

My application needs session tracking including gathering new data from each new page (input from form, time in page etc). when the user leaves my site, i need to make sure all the set of session data is stored to the DB.
I read a lot about session tracking and all it's possibilities(cookies, URLs, session params etc.). I'm asking efficiency. there are 3 major ways i figure:

*1* store in the $_SESSION all the params I need for the curret session. Is the machine and resources handling in PHP on Linux more stable in the way that I can load 20/30 different parameters on each session ? In ASP the site would crash in a day ... Ofcourse I can build a sessionHandler class and assign it to the session at the begining, would that work ?

*2* Another option is at each page load to save the new gathered data to the DB directly since i can store the session id somewhere . this means establishing connection with DB on each load and saving. I could also save session data on a text (or XML) page and when session ends to dump it to db. problem is calling for resources on EACH page load, good or not ?

*3* what I believe is right, and I did it with my asp code, question is if it's not overshoot: the main HTML page has an inner frame within, thats where the changing content is. I have JS params on the main HTML page(or a handling JS class), and on every reload of the inner frame, i dump the params to the HTML main page JS params. when the session dies, i have on_unload that send the data to the server as inner form data. this way i contact the DB only when the session ends, and still can maintain the data from the session. I can still keep a little general info (like id) on each session using cookies and/or $_SESSION.

So, long question ... but i think it's pretty important ....
there are 3 basic ways to maintain data, which is most efficient in PHP ??? how do resource handling on linux makes the job easier ?

thank you very very much if you got this far in reading .. and thank you even more if you reply :-)
yaniv[/quote]
Thank you for the post.
Hi guys, Im a newbie. Nice to join this forum.
Back to top
View user's profile Send private message
philiboy



Joined: 01 Mar 2010
Posts: 1

PostPosted: Mon Mar 01, 2010 9:19 pm    Post subject: Reply with quote

the problem is in your DB.
I have it in the past... try to change your primary key
Back to top
View user's profile Send private message
samantha_sync



Joined: 16 Mar 2010
Posts: 39

PostPosted: Tue Mar 16, 2010 6:19 pm    Post subject: Reply with quote

the root of your problem is from your DB,i think..
Back to top
View user's profile Send private message
LogoVendor



Joined: 19 May 2010
Posts: 3

PostPosted: Mon Jun 28, 2010 4:33 pm    Post subject: Reply with quote

you should use a cookie if you dont 'like' the sessions.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
WeberTrivia Questions WeberTrivia Questions
 Think you are smart? Prove it!. Try your skills with these questions :
 WeberTrivia QuestionsRecursive arrays and multi-dimensional arrays are one and the same. (PHP and MySQL)
 WeberTrivia QuestionsThe \"cache_dir\" tag of the squid configuration has a default of /var/spool/squid. (Linux)

WeberTrivia Questions



PHP Code Examples
 Stream diffrent sizes of images from a single image to save disk space.
 JavaScript dropdown list menu to switch any page.
 Dump the contents of a PHP variable in html format with a recursive list of subfolders and files from a given root directory.
 PHP Dump in html format the contents of one array variable with a recursive list of the nested array variables inside.
 Link Extractor - This function is used to extract links from a given URL. This will convert relative path into absolute path and also remove PHPSESSID stuff.
 Building a Dynamic Form using Javascript and innerHTML. Add form elements in realtime without refreshing the page.
 A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function.
Post new topic   Reply to topic    WeberForums.com Forum Index -> Theory related web design All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
PHP Forum :: MySQL Forum :: Java Script Forum