Page 1 of 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default Sessions help :(

    Hey

    I'd like to say sorry to begin with, because im learning PHP, and all i keep doing is come back here for advice, so i'd be more than understanding if you lot didnt help me anymore!

    My problem now is:
    Code:
    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/clubpixe/public_html/callum/index.php:10) in /home/clubpixe/public_html/callum/index.php on line 20
    
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/clubpixe/public_html/callum/index.php:10) in /home/clubpixe/public_html/callum/index.php on line 20
    that comes up on my log in form

    Now the code it mentions is this:

    PHP Code:
    <?php
     
    session_start
    ();
    include(
    "config.php");
     
    if(isset(
    $_SESSION['logged_in'])) {
     
    }
    And i just dont know what i've done wrong.... Knowing me it'll be a very silly mistake... and if its not too much to ask, If you do try and help can you tell me how you came to that conclusion so i can learn rather than copy and paste??

    Thank yooo
    Callum
    Back for a while

  2. #2
    Join Date
    Jan 2006
    Location
    Kent
    Posts
    987
    Tokens
    0

    Default

    You need to put session_start(); before anything else on the page, so you could just do <?php session_start(); ?> right at the top of the page, before any other code.
    This is our situation and we're happy to be here,
    I wouldn't change this place for anything.


  3. #3
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    Quote Originally Posted by Joe! View Post
    You need to put session_start(); before anything else on the page, so you could just do <?php session_start(); ?> right at the top of the page, before any other code.

    Thanks alot, +rep!
    Back for a while

  4. #4
    Join Date
    Jan 2006
    Location
    Kent
    Posts
    987
    Tokens
    0

    Default

    Your welcome.
    This is our situation and we're happy to be here,
    I wouldn't change this place for anything.


  5. #5
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    Thing is though..... Its on a page with Div's etc.... Does this mean that just;

    <? session_start (); ?> goes before the Div or is it that enter phrase inc. the config.php and stuff???

    Thanks again
    Back for a while

  6. #6
    Join Date
    Jan 2006
    Location
    Kent
    Posts
    987
    Tokens
    0

    Default

    It should go right at the top of page. before the <head></head> tags.
    This is our situation and we're happy to be here,
    I wouldn't change this place for anything.


  7. #7
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    thanks
    Back for a while

  8. #8
    Join Date
    Sep 2008
    Posts
    718
    Tokens
    0

    Default

    Quote Originally Posted by Joe! View Post
    It should go right at the top of page. before the <head></head> tags.
    Before doctype?
    +.net - omg it's coming o_o

  9. #9
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    Code:
    Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at /home/clubpixe/public_html/callum/index.php:3) in /home/clubpixe/public_html/callum/index.php on line 3
    
    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/clubpixe/public_html/callum/index.php:3) in /home/clubpixe/public_html/callum/index.php on line 3


    Now i get that like above my layout ^^
    Back for a while

  10. #10
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    Sorted!
    Goes above doctype

    thanks to everyone for their help I'll plus rep when i can!
    Back for a while

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •