dtrm_mora Posted September 1, 2009 Share Posted September 1, 2009 Hi All, In the web site I have built, after hosting it, it gets an error message such as "Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /hermes/bosweb/web111/b1117/ipw.garmart/public_html/gents_cloths.php:1) in /hermes/bosweb/web111/b1117/ipw.garmart/public_html/third side bar.php on line 2" what seems to be the problem? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/172689-session-errors/ Share on other sites More sharing options...
mayfair Posted September 1, 2009 Share Posted September 1, 2009 Have you started the session? <?php session_start(); ?> Needs to be at the top of every page you want to use sessions. Quote Link to comment https://forums.phpfreaks.com/topic/172689-session-errors/#findComment-910253 Share on other sites More sharing options...
PFMaBiSmAd Posted September 1, 2009 Share Posted September 1, 2009 The error message states where the output is occuring that is causing the problem - output started at /hermes/bosweb/web111/b1117/ipw.garmart/public_html /gents_cloths.php:1 (line 1) What is line 1 of gents_cloths.php? Quote Link to comment https://forums.phpfreaks.com/topic/172689-session-errors/#findComment-910255 Share on other sites More sharing options...
dtrm_mora Posted September 1, 2009 Author Share Posted September 1, 2009 Yes i started the session!!! First line in my code is the session_start() function. The error disappears when the function is removed. But then the problem is, session variables are not working... Pls help me with this... Quote Link to comment https://forums.phpfreaks.com/topic/172689-session-errors/#findComment-910271 Share on other sites More sharing options...
JonnoTheDev Posted September 1, 2009 Share Posted September 1, 2009 This file must be producing output prior to session_start(). The function must be called prior to any output. public_html/third side bar.php Quote Link to comment https://forums.phpfreaks.com/topic/172689-session-errors/#findComment-910283 Share on other sites More sharing options...
dtrm_mora Posted September 1, 2009 Author Share Posted September 1, 2009 Here is the code... As u can see, theres no output prior to session_start() function call..... <?php session_start(); include('session_manage.php'); if($session->is_logged_in()){ // if user not logged in $session->session_variables(); } else{ //echo "not logged"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Design by Free CSS Templates http://www.freecsstemplates.org Released for free under a Creative Commons Attribution 2.5 License Name : Swanky Description: A three-column, fixed-width design suitable for news sites and blogs. Version : 1.0 Released : 20080227 --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php include('page_title.php');?></title> <meta name="keywords" content="" /> <meta name="description" content="" /> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> </head> <body> <!-- start header --> <div id="header"> <div id="menu"> <?php include('main_links.php');?> </div> </div> <div id="logo"> <h1><a href="index.php"><?php include('page_header.php');?></a></h1> <h2> it's all about designs...</h2> </div> <!-- end header --> <hr /> <!-- start page --> <div id="page"> <!-- start content --> <div id="content"> <div class="post"> <table align="center" width="138%"> <?php // include files include('database_interract.php'); include('ValidateData.php'); // get the limit and the starting numbers $begin=$_GET['start']; $limit=$_GET['limit']; $start=$begin+$limit; //echo "@@@".$start; if($begin==0){ // then the first page is called $_SESSION['page_count']=0; //echo "page1"; $begin=1; $start=0; } else if($begin==3){ $start=$_SESSION['page_count']=($_SESSION['page_count']+3); } else if($begin==2){ $start=$_SESSION['page_count']=($_SESSION['page_count']-3); if($start<=0){ $start=0; } } $message=""; /* - This page should view all the designs that were uploaded by the current user. - find a limit to be displayed in a single page. - add 'next' links to display further records in the samapage.. - when diplaying items. ! - display the picture ! - display details of the design. ! - display any comments (a link to comments.php?user_id=''&product_id='') */ if($db_manage->connect_to_db()){ // connect to the database. // obtain details from the database // $message="Designs are displayed"; $gents_result=$db_manage->get_product_info_bycatagory('gents',$start); $message="| <a href=\"gents_cloths.php?start=0\">First Page</a> | <a href=\"gents_cloths.php?start=2\">Previous Page</a> | <a href=\"gents_cloths.php?start=3\">Next Page</a> |"; $rows=mysql_num_rows($gents_result); //echo "@@@@@@@@@@@".$rows; while($gents_array=mysql_fetch_array($gents_result,MYSQL_NUM)){ $p_id=$gents_array[0]; $picture_result=$db_manage->get_picture_info($gents_array[0]); $picture_array=mysql_fetch_array($picture_result,MYSQL_NUM); // get the file path $file_path=$picture_array[2]; // get the file from the location ?> <tr> <td width="36%" rowspan="10" valign="top"><img src="<?php echo $file_path;?>" width="150" height="150"></td> <td colspan="2">Designer : <?php echo $gents_array[3];?> </td> </tr> <tr> <td colspan="2">Catagory : <?php echo $gents_array[1];?> </td> </tr> <tr> <td colspan="2">Description : <?php echo $gents_array[4]; ?> </td> </tr> <tr> <td colspan="2">Price : <?php echo $gents_array[5]; ?> </td> </tr> <tr> <td colspan="2">Material : <?php echo $gents_array[6];?> </td> </tr> <tr> <td width="15%" rowspan="4">Sizes : </td> <td width="49%">Small : <?php echo $gents_array[7];?> </td> </tr> <tr> <td>Medium : <?php echo $gents_array[8];?> </td> </tr> <tr> <td>Large : <?php echo $gents_array[9];?> </td> </tr> <tr> <td>X-Large : <?php echo $gents_array[10];?> </td> </tr> <tr> <td colspan="2">Upload Date : <?php echo $gents_array[12];?> </td> </tr> <tr> <td colspan="2"> <?php if($session->is_logged_in()){ echo "| <a href=\"comments.php?pr_id=$gents_array[0]\">Comment</a> | "; echo "| <a href=\"view_comments.php?product_id=$gents_array[0]\">View Comments</a> | "; } if($_SESSION['catagory']=="buyer"){ echo "<a href=\"make_order.php?prod_id=$gents_array[0]&designer=$gents_array[3]\">Buy Now</a> | "; } ?> </td> <td> <?php ?> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td></td> <td></td> </tr> <tr> <td bgcolor="#009999"></td> <td bgcolor="#009999"></td> </tr> <hr> <?php }// end of while } else{ $message="Error occurred while connecting to the database."; } ?> </table> </div> <div class="post"> <?php echo $message;?> </div> </div> <!-- end content --> <!-- start sidebar one --> <!-- end sidebar one --> <!-- start sidebar two --> <div id="sidebar2" class="sidebar"> <?php include('third side bar.php');?> </div> <!-- end sidebar two --> <div style="clear: both;"> </div> </div> <!-- end page --> <hr /> <!-- start footer --> <div id="footer"> <p><?php include('bottom_header.php');?></p> </div> <!-- end footer --> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/172689-session-errors/#findComment-910289 Share on other sites More sharing options...
PFMaBiSmAd Posted September 1, 2009 Share Posted September 1, 2009 Someone already mentioned where to look for the output that is causing the problem - The error message states where the output is occuring that is causing the problem - output started at /hermes/bosweb/web111/b1117/ipw.garmart/public_html /gents_cloths.php:1 (line 1) What is line 1 of gents_cloths.php? Quote Link to comment https://forums.phpfreaks.com/topic/172689-session-errors/#findComment-910292 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.