Jump to content

session is displaying error after execution


Pawan_Agarwal
Go to solution Solved by 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 .................

Link to comment
Share on other sites

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.

Edited by 0xMatt
Link to comment
Share on other sites

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...........
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.