Derekd Posted April 21, 2013 Share Posted April 21, 2013 Hello all, All my scripts using database sessions work fine, except for this one..... Probably kick myself when I finally get the light bulb to go on. Here is some of the relevant code and accompanying errors, hope somebody can help me. <?phprequire_once('./includes_proc/config.inc.php');$page_title = 'Select My Other Properties';include('./includes_proc/header_c5.php'); if(isset($_POST['submitted'])) { if(isset($_POST['prop'])) { $new_prop = (int) $_POST['prop']; etc.... The header script that gets included... <?php/* * This page begins the HTML header for the site. * The header alse creates the right hand column. * This page call session_start() * */ // Start session if not logged in if(!isset($_SESSION['in'])) { ob_start(); require_once('db_sessions.inc.php'); } // Check for a $page_title value: - etc.......... The script starting db_session.... # **************************** ## ***** END OF FUNCTIONS ***** ## **************************** #// Declare the functions to use:session_set_save_handler('open_session', 'close_session', 'read_session', 'write_session', 'destroy_session', 'clean_session');// Make whatever other changes to the session settings.// Start the session:session_start(); - ( Line 123)?> An abbreviated version of the error data..... An error occurred in script '/home/luxacom/public_html/ busapp_proc/includes_proc/db_sessions.inc.php' on line 123:<br />session_start() [<a href='function.session-start'>function.session-start</a>]: Cannot send session cache limiter - headers already sent (output started at /home/luxacom/public_html/busapp_proc/sel_prop.php:2)<br />Date/Time: 4-21-2013 15:43:04<br /><pre>Array( [_REQUEST] => Array ( [phpSESSID] => 058975b6b1eb4dc22bc8cf28b31fd0 80 ) [contact_email] => luxadry@gmail.com [local] => [debug] => [dbc] => mysqli Object ( ) [page_title] => Select My Other Properties [sdbc] => mysqli Object ( ) [HTTP_SESSION_VARS] => Array ( [op_units] => 1 [van] => 3 [agent] => f76e1da45697f2bea834d3cc529b10fb [cid] => 526 [in] => 526 => mentone@gmail.com [id_prop] => 567 [cust_type] => residential [mult_props] => 1 ) [_SESSION] => Array ( [op_units] => 1 [van] => 3 [agent] => f76e1da45697f2bea834d3cc529b10fb [cid] => 526 [in] => 526 => mentone@gmail.com [id_prop] => 567 [cust_type] => residential [mult_props] => 1 ))</pre><br /> Hope this makes sense Derek Link to comment Share on other sites More sharing options...
HartleySan Posted April 21, 2013 Share Posted April 21, 2013 Do any of your includes about the session_start function contain any output to the browser? Link to comment Share on other sites More sharing options...
Derekd Posted April 21, 2013 Author Share Posted April 21, 2013 Hi HartleySan, No they all emailed. (Are you asking about the error messages?) Link to comment Share on other sites More sharing options...
HartleySan Posted April 21, 2013 Share Posted April 21, 2013 No, I mean that you are getting a "Headers already sent" error, which means that you are outputting something to the browser before the session_start function. Do a search for the text below on the following page: http://php.net/manual/en/function.session-start.php "Headers already sent" You'll see that many people have had the same problem, and have posted their solutions. Link to comment Share on other sites More sharing options...
Derekd Posted April 21, 2013 Author Share Posted April 21, 2013 Thanks for that HartleySan, but would that apply if ob_start() is used Link to comment Share on other sites More sharing options...
margaux Posted April 21, 2013 Share Posted April 21, 2013 You need to start the session even if you are using output buffering. You have checked for a session variable before you start the session so I think that's why you are getting the error. if(!isset($_SESSION['in'])) { ob_start(); Link to comment Share on other sites More sharing options...
Derekd Posted April 25, 2013 Author Share Posted April 25, 2013 Thanks for that Margaux, and sorry I am only responding now (hectic times). With the help from this board and some revision, all my issues around db_sessions are now resolved. Thank you to everyone. Cheers Derek Link to comment Share on other sites More sharing options...
Derekd Posted May 4, 2013 Author Share Posted May 4, 2013 Hi, By the way the problem that existed in the "select other properties" script, was that the first line of code was empty. Must have hit enter by my mistake on the first line when doing the code for the script. I knew I would end up kicking myself. Cheers Derek Link to comment Share on other sites More sharing options...
HartleySan Posted May 4, 2013 Share Posted May 4, 2013 I've had that problem before too, where I *know* what the problem is, but I still can't find it. Good job though. I bet that that was one heck of a eureka moment when you finally solved the problem. Link to comment Share on other sites More sharing options...
Derekd Posted May 11, 2013 Author Share Posted May 11, 2013 You bet it was, and a massive self inflicted bruise on my shin... Link to comment Share on other sites More sharing options...
Recommended Posts