| | #1 |
| HyperActive Warrior Join Date: 2009
Posts: 212
Thanks: 11
Thanked 5 Times in 5 Posts
|
Hey All so a few things going on here I can use a hand with 1) I'm getting session error can't send header already sent issue and it's the very first thing being called I attached image for viewing as the 2) issue is looking at image when I add the session_start it messes up all the alignment of the page if I remove it works fine?? PHP Code: |
| | |
| |
| | #2 |
| HyperActive Warrior War Room Member Join Date: 2012
Posts: 290
Thanks: 13
Thanked 46 Times in 46 Posts
|
Make sure the <?php is on line 1 column 1. You may need to look at the ob_start and ob_flush functions.
|
| | |
| |
| | #3 |
| HyperActive Warrior Join Date: 2009
Posts: 212
Thanks: 11
Thanked 5 Times in 5 Posts
|
and why you think I'm loosing alignment of page?
|
| | |
| |
| | #4 |
| HyperActive Warrior Join Date: 2009
Posts: 212
Thanks: 11
Thanked 5 Times in 5 Posts
|
dunno OB's don't work I had already tried flush and start both changed nothing?
|
| | |
| |
| | #5 |
| HyperActive Warrior War Room Member Join Date: 2012
Posts: 290
Thanks: 13
Thanked 46 Times in 46 Posts
|
I'm thinking the alignment issue is do to the PHP error message being displayed. The session_start() function should not cause an alignment issue. Use a browser with some developer tools like Chrome or Firefox so that you can take a look at the elements individually on the page. Maybe some CSS file isn't loaded because of the PHP error?
|
| | |
| |
| | #6 |
| HyperActive Warrior Join Date: 2009
Posts: 212
Thanks: 11
Thanked 5 Times in 5 Posts
|
ok, I believe the same as after I wrote that I had another look and yes it's prob cause the text it being output.. anyhow does anyone have another solution I can try to fix this error...
|
| | |
| |
| | #7 |
| HyperActive Warrior War Room Member Join Date: 2012
Posts: 290
Thanks: 13
Thanked 46 Times in 46 Posts
|
Can you zip the code file and post it for a look? Is this code included by some other file? Something has output to the browser before session_start() started, it doesn't have to be much a single space is all that is required for session_start() to produce the error. |
| | |
| |
| | #8 |
| Linux Geek War Room Member Join Date: 2010 Location: United Kingdom
Posts: 228
Thanks: 93
Thanked 51 Times in 42 Posts
|
Unless I am mistaken you need to close the session at the end of your code... At the moment you are trying to open a session on top of a session thus the error headers already sent.
|
| |
| | #9 | |
| HyperActive Warrior War Room Member Join Date: 2012
Posts: 290
Thanks: 13
Thanked 46 Times in 46 Posts
|
<?php if (!isset($_SESSION)) { session_start(); } ?> If you want to debug why the session already existed you could add the following to get clues about the session. <?php else { echo '<pre>' . print_r($_SESSION, TRUE) . '</pre>'; } ?> | |
| | ||
| |
| | #10 | |
| Linux Geek War Room Member Join Date: 2010 Location: United Kingdom
Posts: 228
Thanks: 93
Thanked 51 Times in 42 Posts
|
| |
| |
| The Following 2 Users Say Thank You to Stuart Macfarlane For This Useful Post: |
|
| Bookmarks |
| Tags |
| sessionstart |
| |