Cross-page variables
Moderator: General Moderators
-
hayson1991
- Forum Newbie
- Posts: 14
- Joined: Thu Mar 20, 2008 1:19 pm
Cross-page variables
Hi, I'm new to this forum.
Does anyone here know a way to share variables between concurrent (i.e. both running at the same time) pages in php?
I know that I can probably do this with sessions. But it's bad to have a session open all the time right?
I also know that MySQL can also be used, but that will be too many MySQL calls...
(This is for something similar to a chat program.)
Thanks.
Does anyone here know a way to share variables between concurrent (i.e. both running at the same time) pages in php?
I know that I can probably do this with sessions. But it's bad to have a session open all the time right?
I also know that MySQL can also be used, but that will be too many MySQL calls...
(This is for something similar to a chat program.)
Thanks.
Re: Cross-page variables
cocurrent pages by the same user? If you want a chat use a database.
-
hayson1991
- Forum Newbie
- Posts: 14
- Joined: Thu Mar 20, 2008 1:19 pm
Re: Cross-page variables
But isn't that too many calls to MySQL? or are you talking about another database system?yacahuma wrote:cocurrent pages by the same user? If you want a chat use a database.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Cross-page variables
Using mysql should be ok, it is a lot quicker than people think 
-
hayson1991
- Forum Newbie
- Posts: 14
- Joined: Thu Mar 20, 2008 1:19 pm
Re: Cross-page variables
Ok, I tried that, but I'm just afraid that it'll eventually call mysql too many times and get a max_connection error...Jcart wrote:Using mysql should be ok, it is a lot quicker than people think
-
hayson1991
- Forum Newbie
- Posts: 14
- Joined: Thu Mar 20, 2008 1:19 pm
Re: Cross-page variables
I've also been wondering if it is possible for one concurrent page to cause an action on another concurrent page.
i.e. if person A is loading a page and person B just submitted something, person A's page can, during load, add extra content to itself.
i.e. if person A is loading a page and person B just submitted something, person A's page can, during load, add extra content to itself.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Cross-page variables
It can, but you need to poll at some point. You might want to look into Ajax/Comet.
(#10850)
Re: Cross-page variables
You are not going to get any connection max. Remember that PHP only connects to the database when is creating the html. After those milliseconds the connection is release.
-
hayson1991
- Forum Newbie
- Posts: 14
- Joined: Thu Mar 20, 2008 1:19 pm
Re: Cross-page variables
So, there's no way to do this without polling? I'm currently trying to replicate Comet, but I really don't want to poll continuously.arborint wrote:It can, but you need to poll at some point. You might want to look into Ajax/Comet.
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Cross-page variables
HTTP is stateless, therefore, you'll require polling to continuously update the page. I wouldn't worry about performance until it becomes an issue.hayson1991 wrote:So, there's no way to do this without polling? I'm currently trying to replicate Comet, but I really don't want to poll continuously.arborint wrote:It can, but you need to poll at some point. You might want to look into Ajax/Comet.
-
hayson1991
- Forum Newbie
- Posts: 14
- Joined: Thu Mar 20, 2008 1:19 pm
Re: Cross-page variables
well, at the scale I'm making this for, performance will become an issue... do you have any suggestions? thanks.Jcart wrote:HTTP is stateless, therefore, you'll require polling to continuously update the page. I wouldn't worry about performance until it becomes an issue.hayson1991 wrote:So, there's no way to do this without polling? I'm currently trying to replicate Comet, but I really don't want to poll continuously.arborint wrote:It can, but you need to poll at some point. You might want to look into Ajax/Comet.
(I want this to be an extensible project, so, I want as good of a performance as possible. Any extensions to use instead of MySQL would be appreciated...)