• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 24478
  • Last Modified:

Warning: session_start(): Cannot send session cache limiter - headers already sent

How do I get rid of the errors?  I don't know php, just VB

Warning: session_start(): Cannot send session cache limiter - headers already sent
0
sendtojp
Asked:
sendtojp
  • 7
  • 4
2 Solutions
 
nesnemisCommented:
Hi sendtojp,

It is because you call session_start() after you've already written ouput to the screen. You should put it at the beginning of your php-file.

nesnemis
0
 
sendtojpAuthor Commented:
<html>
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>cool_default.gif</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html;">
<!-- Fireworks MX Dreamweaver MX target.  Created Wed Sep 18 14:44:05 GMT-0700 (Pacific Daylight Time) 2002-->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body bgcolor="#ffffff">

&nbsp;
<p>&nbsp;</p>
<p>



Here is the first part of the code, I can't find the session_start

Thanks
0
 
sendtojpAuthor Commented:
HELP!

There is no session_start()
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
nesnemisCommented:
could you post all of the php code?
0
 
sendtojpAuthor Commented:
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>cool_default.gif</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html;">
<!-- Fireworks MX Dreamweaver MX target.  Created Wed Sep 18 14:44:05 GMT-0700 (Pacific Daylight Time) 2002-->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body bgcolor="#ffffff">

&nbsp;
<p>&nbsp;</p>
<p>

<?php
  session_start();
  include("secure.php");
?>
<?php require_once('../Connections/TestName2.php'); ?>
<?php
//This will remove the dashes in the date formatting from the variable $spot_date passed in the URL
$date = "$spot_date";
//echo $date;
//split day, month and year into an array
$date_array = explode("-", $date);
//$spot_date in the new format
$date = $date_array[0] . $date_array[1] . $date_array[2];
//echo $date;
?>
<?php
mysql_select_db($database_TestName2, $TestName2);
$query_Sumofcalls = "SELECT Sum(tbl_spot_times.calls) AS SumOfcalls, tbl_spots.spot_date, tbl_spots.client_id
FROM tbl_spots INNER JOIN tbl_spot_times ON tbl_spots.spot_id = tbl_spot_times.spot_id
GROUP BY tbl_spots.spot_date, tbl_spots.client_id
HAVING ((tbl_spots.client_id = " . $HTTP_SESSION_VARS['ref'] . ") and (tbl_spots.spot_date = $date))";
$Sumofcalls = mysql_query($query_Sumofcalls, $TestName2) or die(mysql_error());
$row_Sumofcalls = mysql_fetch_assoc($Sumofcalls);
$totalRows_Sumofcalls = mysql_num_rows($Sumofcalls);
?>
<?php
mysql_select_db($database_TestName2, $TestName2);
$query_Recordset1 = "SELECT tbl_station.call_letters, tbl_station.dial_position, tbl_station.slogan, tbl_spot_times.personality, tbl_spot_times.cost, tbl_spot_times.spot_time, tbl_spot_times.calls, tbl_client.client_name, tbl_spots.client_id, tbl_spots.spot_date
FROM ((tbl_spots INNER JOIN tbl_spot_times ON tbl_spots.spot_id = tbl_spot_times.spot_id) INNER JOIN tbl_station ON tbl_spots.station_id = tbl_station.call_letters) INNER JOIN tbl_client ON tbl_spots.client_id = tbl_client.client_id
      WHERE ((tbl_spots.client_id = " . $HTTP_SESSION_VARS['ref'] . ") and (tbl_spots.spot_date = $date))";
$Recordset1 = mysql_query($query_Recordset1, $TestName2) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?></p>

<table border="0" cellpadding="0" cellspacing="0" width="770">
<!-- fwtable fwsrc="Untitled" fwbase="cool_default.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
  <tr>
   <td><img src="images/spacer.gif" width="80" height="1" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="602" height="1" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="88" height="1" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
  </tr>

  <tr>
   <td colspan="3"><img name="cool_default_r1_c1" src="images/cool_default_r1_c1.gif" width="770" height="94" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="1" height="94" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="2"><img name="cool_default_r2_c1" src="images/cool_default_r2_c1.gif" width="80" height="337" border="0" alt=""></td>
    <td><!-- InstanceBeginEditable name="body" -->
      <div align="center">
                 <p><strong><font size="5">Spot Report For<br>
              <strong><font size ="3"><?php echo $row_Recordset1['client_name'];?></font></strong><br>
          </font></strong><font size="5"><font size="3"><?php echo $row_Sumofcalls['spot_date']; ?></font></font></p>
        <table border="1">
          <tr>
            <td><div align="center"><strong>Calls Received</strong></div></td>
          </tr>


Here it is Thank You, I will owe you one ! :)
0
 
sendtojpAuthor Commented:
I replaced some names for confidentality
0
 
stufferCommented:
You could just move this section to the start of the file:-

<?php
  session_start();
  include("secure.php");
?>
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>cool_default.gif</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html;">
<!-- Fireworks MX Dreamweaver MX target.  Created Wed Sep 18 14:44:05 GMT-0700 (Pacific Daylight Time) 2002-->
 ........
0
 
nesnemisCommented:
sendtojp,
> <head>
> <!-- InstanceBeginEditable name="doctitle" -->
> <title>cool_default.gif</title>
> <!-- InstanceEndEditable -->
> <meta http-equiv="Content-Type" content="text/html;">
> <!-- Fireworks MX Dreamweaver MX target.  Created Wed Sep 18 14:44:05
> GMT-0700 (Pacific Daylight Time) 2002-->
> <!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
> </head>
> <body bgcolor="#ffffff">

> &nbsp;
> <p>&nbsp;</p>
> <p>

> <?php
> session_start()
This must be moved to the top of the file because you output to the browser before this point.

Like this:
<?php session_start() ?>
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>cool_default.gif</title>
<!-- InstanceEndEditable -->
0
 
sendtojpAuthor Commented:
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /new/home/Roger/Redwood/dc_spotreport.php:14) in /new/home/Roger/Redwood/dc_spotreport.php on line 15

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /new/home/Roger/Redwood/dc_spotreport.php:14) in /new/home/Roger/Redwood/dc_spotreport.php on line 15




<html>

<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>cool_default.gif</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html;">
<!-- Fireworks MX Dreamweaver MX target.  Created Wed Sep 18 14:44:05 GMT-0700 (Pacific Daylight Time) 2002-->
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body bgcolor="#ffffff">





<?php
  session_start();
  include("secure.php");
?>





<p>&nbsp;
<p>&nbsp;</p>
<p>


<?php require_once('../Connections/RedtreePlane2.php'); ?>
<?php
//This will remove the dashes in the date formatting from the variable $spot_date passed in the URL
$date = "$spot_date";
//echo $date;
//split day, month and year into an array
$date_array = explode("-", $date);
//$spot_date in the new format
$date = $date_array[0] . $date_array[1] . $date_array[2];
//echo $date;
?>
<?php
mysql_select_db($database_RedtreePlane2, $RedtreePlane2);
$query_Sumofcalls = "SELECT Sum(tbl_spot_times.calls) AS SumOfcalls, tbl_spots.spot_date, tbl_spots.client_id
FROM tbl_spots INNER JOIN tbl_spot_times ON tbl_spots.spot_id = tbl_spot_times.spot_id
GROUP BY tbl_spots.spot_date, tbl_spots.client_id
HAVING ((tbl_spots.client_id = " . $HTTP_SESSION_VARS['ref'] . ") and (tbl_spots.spot_date = $date))";
$Sumofcalls = mysql_query($query_Sumofcalls, $RedtreePlane2) or die(mysql_error());
$row_Sumofcalls = mysql_fetch_assoc($Sumofcalls);
$totalRows_Sumofcalls = mysql_num_rows($Sumofcalls);
?>
<?php
mysql_select_db($database_RedtreePlane2, $RedtreePlane2);
$query_Recordset1 = "SELECT tbl_station.call_letters, tbl_station.dial_position, tbl_station.slogan, tbl_spot_times.personality, tbl_spot_times.cost, tbl_spot_times.spot_time, tbl_spot_times.calls, tbl_client.client_name, tbl_spots.client_id, tbl_spots.spot_date
FROM ((tbl_spots INNER JOIN tbl_spot_times ON tbl_spots.spot_id = tbl_spot_times.spot_id) INNER JOIN tbl_station ON tbl_spots.station_id = tbl_station.call_letters) INNER JOIN tbl_client ON tbl_spots.client_id = tbl_client.client_id
      WHERE ((tbl_spots.client_id = " . $HTTP_SESSION_VARS['ref'] . ") and (tbl_spots.spot_date = $date))";
$Recordset1 = mysql_query($query_Recordset1, $RedtreePlane2) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?></p>

<table border="0" cellpadding="0" cellspacing="0" width="770">
<!-- fwtable fwsrc="Untitled" fwbase="cool_default.gif" fwstyle="Dreamweaver" fwdocid = "742308039" fwnested="0" -->
  <tr>
   <td><img src="images/spacer.gif" width="80" height="1" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="602" height="1" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="88" height="1" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="1" height="1" border="0" alt=""></td>
  </tr>

  <tr>
   <td colspan="3"><img name="cool_default_r1_c1" src="images/cool_default_r1_c1.gif" width="770" height="94" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="1" height="94" border="0" alt=""></td>
  </tr>
  <tr>
   <td rowspan="2"><img name="cool_default_r2_c1" src="images/cool_default_r2_c1.gif" width="80" height="337" border="0" alt=""></td>
    <td><!-- InstanceBeginEditable name="body" -->
      <div align="center">
                 <p><strong><font size="5">Spot Report For<br>
              <strong><font size ="3"><?php echo $row_Recordset1['client_name'];?></font></strong><br>
          </font></strong><font size="5"><font size="3"><?php echo $row_Sumofcalls['spot_date']; ?></font></font></p>
        <table border="1">
          <tr>
            <td><div align="center"><strong>Calls Received</strong></div></td>
          </tr>
          <?php do { ?>
          <tr>
            <td><div align="center"><?php echo $row_Sumofcalls['SumOfcalls']; ?></div></td>
          </tr>
          <?php } while ($row_Sumofcalls = mysql_fetch_assoc($Sumofcalls)); ?>
        </table>
        <br>
        <table border="1">
          <tr>
            <td width="157"><div align="center"><strong>Call Letters</strong></div></td>
            <td width="169"><div align="center"><strong>Dial Position</strong></div></td>
            <td width="200"><div align="center"><strong>Slo2gan</strong></div></td>
            <td width="158"><div align="center"><strong>Personality</strong></div></td>
            <td width="152"><div align="center"><strong>Spot Time</strong></div></td>
            <td width="119"><div align="center"><strong>Calls</strong></div></td>
                  <td width="119"><div align="center"><strong>Cost</strong></div></td>
                  <td width="119"><div align="center"><strong>Cost/Call</strong></div></td>          
          </tr>
          <?php do { ?>
          <tr>
            <td><?php echo $row_Recordset1['call_letters']; ?>&nbsp;</td>
            <td><?php echo $row_Recordset1['dial_position']; ?>&nbsp;</td>
            <td width="550"><?php echo $row_Recordset1['slogan']; ?>&nbsp;</td>
            <td><?php echo $row_Recordset1['personality']; ?>&nbsp;</td>
            <td><?php echo $row_Recordset1['spot_time']; ?>&nbsp;</td>
            <td><?php echo $row_Recordset1['calls']; ?>&nbsp;</td>
                  <td>$<?php echo $row_Recordset1['cost']; ?>&nbsp;</td>
                  <td>$<?php echo $row_Recordset1['cost']; ?>&nbsp;</td>          
          </tr>
          <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
        </table>
        <p>
            <a href="default.php">Home</a>
            <a href="../logoff.php">Logoff</a></p>
      </div>
      <!-- InstanceEndEditable --></td>
   <td rowspan="2"><img name="cool_default_r2_c3" src="images/cool_default_r2_c3.gif" width="88" height="337" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="1" height="301" border="0" alt=""></td>
  </tr>
  <tr>
   <td><img name="cool_default_r3_c2" src="images/cool_default_r3_c2.gif" width="602" height="36" border="0" alt=""></td>
   <td><img src="images/spacer.gif" width="1" height="36" border="0" alt=""></td>
  </tr>
</table>
<?php
mysql_free_result($Sumofcalls);

mysql_free_result($Recordset1);
?>
</body>
</html>
<!-- InstanceBegin template="/Templates/cool_default.dwt" codeOutsideHTMLIsLocked="false" -->
<!-- InstanceEnd -->


How should the code read?  I try to move the block of code only to have it move again back I am using FrontPage?  Maybe there my problem?
0
 
nesnemisCommented:
you MUST have session_start() at the top or else you will get the warning.
I don't recommend using frontpage for generation html, or any wysiwyg editor for that matter...
0
 
sendtojpAuthor Commented:
I HATE FRONTPAGE.  It is very good advice

"I don't recommend using frontpage for generation html, or any wysiwyg editor for that matter..."

I used notepad instead.

Do you have any VB,Access questions?  Also send me an e-mail

sendtojp AT hotmail DOT com, It will be worth your while!
0
 
sendtojpAuthor Commented:

Extra Points for     stuffer  &   nesnemis

Just place comment and I will split some points

http://www.experts-exchange.com/Web/Web_Languages/PHP/Q_21209895.html
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now