|
Posted by Gordon Burditt on 07/13/05 19:29
>I am running PHP Version 4.3.11 with Apache 2.0.54 on XP Pro.
>When I do a session_start(); I am getting
>Warning: session_start(): Cannot send session cookie - headers already
>sent in C:\apache\htdocs\sessionTest.php on line 2
You are sending data before the session_start() call. Don't do
that. This includes blank lines, warning messages, and any text.
Move the session_start() call earlier.
>
>
^^^ If this is line 2, it's a blank line outside <?php, and it's
causing your problem. Get rid of it.
><?php
>session_start();
>if ($_SESSION["last_visist"]){
>echo "Date of las visit: ";
>echo date("j F Y, H:i:s", $_SESSION["last_visit"]);
>echo "<br>";
>}
>else
> echo "This is your first visit";
> $_SESSION["last_visit"] = time();
> $_SESSION["num_visits"]++;
>?>
>
>Any suggestion... please
This obviously isn't the real code. The variety of ways you spell
"last" and "visit" make that obvious. Did you want braces around
the statements after the "else"? What is on line 2?
Gordon L. Burditt
Navigation:
[Reply to this message]
|