[dx] Posted March 22, 2012 Author Share Posted March 22, 2012 No, I don't change anywhere.. Today I've tried to store data from index.php file (not calling from function), and it worked.Like it not allow storing from function.. I guess I'll must find other way to solved this. I have one idea on my mind but this is easier way for me.. After some research, I notified that it won't store when it is called in remote file, but when in index.php (some file which is directly loaded to browser) it is ok. Link to comment Share on other sites More sharing options...
[dx] Posted March 27, 2012 Author Share Posted March 27, 2012 I solved this by adding @session_start(); at top of files which works with $_SESSION. Maybe it's wild method but works. Link to comment Share on other sites More sharing options...
thescientist Posted March 27, 2012 Share Posted March 27, 2012 it is, because you aren't really solving the problem, you are just surpressing it. It doesn't seem that hard to have one central place for session start to be called. If you are using it in multiple locations and they are conflicting with each other, it may be worth reconsidering how your application loads. Link to comment Share on other sites More sharing options...
[dx] Posted March 28, 2012 Author Share Posted March 28, 2012 First session_start() is at top of index.php file.And every page loads trough index like index.php?page?some_page And it starts while using page for view, but other server side files messes up, so I need add @session_start() And session is started, with index.php load, but nothing is written to session file, but nevermind, it works. Link to comment Share on other sites More sharing options...
thescientist Posted March 28, 2012 Share Posted March 28, 2012 If everything is loaded through index, then why have multiple session_start() calls going on elsewhere? Link to comment Share on other sites More sharing options...
[dx] Posted March 29, 2012 Author Share Posted March 29, 2012 There are server side files which works only with AJAX, and which are not loaded by index. So session in those files won't work, in loaded by index works fine. Link to comment Share on other sites More sharing options...
phpzag Posted March 31, 2012 Share Posted March 31, 2012 Storing a Session Variable The correct way to store and retrieve session variables is to use the PHP $_SESSION variable: <?php session_start(); // store session data $_SESSION['message']=”hello”; ?>follow this link: http://www.phpzag.com/php-sessions/ Link to comment Share on other sites More sharing options...
thescientist Posted March 31, 2012 Share Posted March 31, 2012 I don't think that was the issue in question Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.