General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Ajax Application Generator Generate database and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
  #1  
Old December 31st, 2002, 03:01 AM
wailin wailin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 5 wailin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
session problem!!pls help me

i tried the shoping cart tutorial in http://www.devarticles.com/art/1/132/3
i sucess to build the cart but when i use same method in my final project which related e-commerce have problem in db.php in line
setcookie("cartId", session_id(), time() + ((3600 * 24) * 30));

*php code

function GetCartId()
{
if(isset($_COOKIE["cartId"]))
{
return $_COOKIE["cartId"];
}
else
{

session_start();
setcookie("cartId", session_id(), time() + ((3600 * 24) * 30)); (line 43)
return session_id();
}
}

it have error:
Warning: Cannot send session cache limiter - headers already sent (output started at c:\web\wai\cart.php:3) in c:\web\db.php on line 43

i have put all document with <?session_start();?> in beginning of coding but still got same problem

pls help me.it is urgent for my final year project.10q



Last edited by wailin : December 31st, 2002 at 03:14 AM.

Reply With Quote
  #2  
Old December 31st, 2002, 03:20 AM
hadley hadley is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 63 hadley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
It sounds like you're sending content before the cookie headers - check line 43 in db.php and make sure you aren't sending anything to the browser (eg. print, echo, or a trailing new line).

Hadley

Reply With Quote
  #3  
Old December 31st, 2002, 03:21 AM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
did you use the ob_start(); function to clear the headers?

and don't forget ob_end_flush(); as i did or else you'll spend many hours sifting back over your code and driving your self crazy
__________________
-Alexander

Reply With Quote
  #4  
Old December 31st, 2002, 04:07 AM
Vasarab69 Vasarab69 is offline
Goldmember
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2002
Posts: 71 Vasarab69 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 m 25 sec
Reputation Power: 6
Send a message via AIM to Vasarab69
i've found that using ob_end_clean(); in similar cases works magic ! also, you may need to call the function through the ob_start() function...

like:

ob_start("$functionname");

.....
.....
.....

ob_end_clean();

(you needn't specify the function name when flushing )

Reply With Quote
  #5  
Old December 31st, 2002, 11:16 AM
hadley hadley is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2002
Posts: 63 hadley User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
It's probably best to do a little more research and find out what the problem actually is - if it's just a trailing newline (which is very easy to add accidentally) it will be easily fixed. Blindly using output buffering is overkill.

Hadley

Reply With Quote
  #6  
Old January 1st, 2003, 01:36 AM
wailin wailin is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 5 wailin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
i not really understand .

i never use ob_start before tat.

Is it i have to add the new ob_start function in db.php?

Is it ob_start have to put before all coding start?

or i just add in my funtion GetcartID?

ob_start(GetcardID)?

php code*

ob_start("$functionname");

.....
.....
.....

ob_end_clean();

WHAT can write inside the ............

thank you very much 4 your kindly to reply my Q.


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > session problem!!pls help me


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway