Jump to content

session is displaying error after execution


Pawan_Agarwal

Recommended Posts

I am working on a code that will help me in creating and maintaining the session on webpage. When the customer visits the page the session must become active and increase the counter by one. I am able to do that. But, when the customer visits that page again, session_start() has been called again and it provided a warning. 

 

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\index.php:13) in C:\xampp\htdocs\counter.php on line 2

 

so, what can I do to omit this warning

 

 

After visiting the page the session gets created and it does not updates further but it gives the above listed warning , looking for a quick answer .................

It looks like you've already posted a topic about this issue.

 

You may want to reconsider your approach to this entire situation.

 

However, to answer your question, you can suppress warnings generated by a function by placing this @ symbol in front of it, e.g:

@session_start();

You can also handle this by modifying your error reporting levels.

 

In the long run, this is never the best practice. Just suppressing errors because of a poor design concept isn't recommended, ever.

the code is not displaying error , however ,  the condition is true and it is updating database, it is not considering it as false, here is the code for you.......

 

 

if(!isset($_SESSION['__name__']))
{
global $total;
$_SESSION['__name__']="Guest";
$total=$total+1;
$result = mysql_query("UPDATE visitors SET TOTAL='$total'") ;
}
 
the session creates successfully and it updates the value in database as soon as i refresh the page............i don't know why it is not halting when there is no error or warning in the code...........

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.