I get a message saying header already sent, please help me

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
misssallyworld
Forum Newbie
Posts: 1
Joined: Fri Aug 14, 2009 3:51 am

I get a message saying header already sent, please help me

Post by misssallyworld »

Code: Select all

<?php
session_start();
 
include($config['webroot'].'../library/config.php');
include($config['webroot'].'library/connectdb.php');
include($config['webroot'].'library/selectdb.php');
 
if (!isset($_SESSION['admin_logged_in']) || $_SESSION['admin_logged_in'] != true) {
    header('Location: admin/login.php');
    exit;
    }
?>
<?php
 
    include('../library/config.php');
    include($config['webroot'].'library/connectdb.php');
    include($config['webroot'].'library/selectdb.php');
 
if(isset($_SESSION['views']))
    $_SESSION['views'] = $_SESSION['views']+ 1;
else
    $_SESSION['views'] = 1;
echo "views = ". $_SESSION['views']; 
 
 
?>


there's no other headers or start sessions() on the page, I've been staring at it for so long. please help me someone
this is the link if you want to see the error massage http://stuweb.cms.gre.ac.uk/~bs107/gigb ... =20&p_f=20
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: I get a message saying header already sent, please help me

Post by onion2k »

One of your include files has a space outside of the <?php ?> tags.
webmonkey88
Forum Newbie
Posts: 20
Joined: Fri Aug 14, 2009 4:30 am

Re: I get a message saying header already sent, please help me

Post by webmonkey88 »

You have some whitespace before your session_start(), there could be a space before the <?php.
Post Reply