|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
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
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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 ) |
|
#5
|
|||
|
|||
|
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 |
|
#6
|
|||
|
|||
|
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. ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > session problem!!pls help me |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|