Current location: Hot Scripts Forums » Programming Languages » PHP » Warning: session_start(): Cannot send session cache limiter


Warning: session_start(): Cannot send session cache limiter

Reply
  #1 (permalink)  
Old 07-12-05, 09:48 PM
jozin jozin is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Warning: session_start(): Cannot send session cache limiter

Hi all,

I got this problem. I just started using session in my page. The this is, its my first time to use it. When I opened the page, the error is:

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\web\apds new\html\Athlete_Info.php:1) in c:\web\apds new\html\Athlete_Info.php on line 398

Warning: Cannot modify header information - headers already sent by (output started at c:\web\apds new\html\Athlete_Info.php:1) in c:\web\apds new\html\Athlete_Info.php on line 400



Here is my code: Athlete_Info.php
Code:
    if (mysql_num_rows($result) ==0) {
      echo "Can not find record.";
    }
    else {
       // display the result
       while ($row=mysql_fetch_assoc($result)){

        // Start the session, register the values & redirect.
	session_name ('YourVisitID');
	ini_set ('session.use_cookies', 0);
	session_start();  // this is line 398
	$_SESSION['Student_number'] = $row['studno'];
	header ("Location:  http://" . $_SERVER['HTTP_HOST']    . dirname($_SERVER['PHP_SELF']) . "/Athlete_Info.php?" . SID); // this is line 400
	exit();

       echo    $student_number = $row['StudNo'];
       echo    $last_name = $row['lname'];
       echo    $first_name = $row['fname'];
       echo    $middle_name = $row['mname'];
       echo    $nick_name = $row['nname'];
       echo    $present_address = $row['presentadd'];
       echo    $course = $row['course'];
       }
    }
What is wrong with my code? I don't understand the meaning of this Warning message. Can can somebody explain it to me?. Any help is very much appreciated.

jozin

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 07-12-05, 10:06 PM
alabaster_lynch alabaster_lynch is offline
Wannabe Coder
 
Join Date: Mar 2005
Posts: 103
Thanks: 0
Thanked 0 Times in 0 Posts
Starting a session occurs before anything is outputted to the screen...Jose
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 07-12-05, 10:26 PM
jozin jozin is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for the tip alabaster_lynch, I'll try moving my session_start() on top and see if it works.

jozin
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 07-12-05, 10:39 PM
jozin jozin is offline
Newbie Coder
 
Join Date: Oct 2004
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
I tried to move the session_start() and the first WARNING disappeared thanks for the help. But the second warning is still there. can you explain what is the meaning of the second warning?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 07-13-05, 12:47 AM
lordy lordy is offline
Newbie Coder
 
Join Date: May 2005
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/Athlete_Info.php?" . SID); // this is line 400

if you want to have header information further down in the page, you need to put ob_start(); at the top of the page with session_start(), this will fix your redirect problem
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning: session_register(): Cannot send session... imsilver PHP 6 10-31-04 06:18 AM
Cannot send session cache limiter??? egzz PHP 1 11-20-03 01:53 PM
Cannot send session cache limiter??? warsome PHP 3 11-18-03 06:17 AM


All times are GMT -5. The time now is 10:44 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.