Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > PHP Databases
|
PHP Databases Using PHP in conjunction with databases. PHP questions not specific to databases should be directed to one of the other PHP forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the PHP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 25th, 2005, 05:27 PM
Authorized User
 
Join Date: Apr 2005
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default passing through sessions not working

Hi,

I am working on the Beginning php,mysql and apache book, chapter 2. I am having problems passing a value through a session.
I have typed the code exactly as it say in the book and I keep getting this error:

Warning: Cannot send session cookie - headers already sent by (output started at c:\phpdev\www\phppractise\music review site\movie1.php:2) in c:\phpdev\www\phppractise\music review site\movie1.php on line 3

Warning: Cannot send session cache limiter - headers already sent (output started at c:\phpdev\www\phppractise\music review site\movie1.php:2) in c:\phpdev\www\phppractise\music review site\movie1.php on line 3
Click here to see information about my favorite movie!

I am not sure what is happening here. Can anyone help?

I have checked the php.ini file for the correct session_save_path which seems to be pointing to the right file.

Any ideas whats wrong?

David


 
Old April 26th, 2005, 05:27 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anshul
Default

U should use session_start() before u send anything ( html o/p) to browser; as PHP warns headers already sent
Simple logic is, if u've already started o/p, why r u re-modifying information ( session information ), sent to browser.

U may create buffer ( 4 PHP script ) by using ob_start()/ob_start()
( not recommended )

 
Old April 26th, 2005, 08:21 AM
Authorized User
 
Join Date: Apr 2005
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I understand what you are saying, and thank you very much for getting back. I will try this out tonight. However, could you explain what o/p means? - silly question I know.

many thanks
David








Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem passing through sessions dmlocke PHP Databases 4 June 26th, 2006 08:08 PM
Passing through sessions dmlocke BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 1 May 15th, 2005 11:35 AM
Passing Variables through Sessions dmlocke Beginning PHP 2 April 27th, 2005 05:40 AM
Passing value without using sessions lic023 Classic ASP Basics 1 July 20th, 2004 09:58 AM
Help! My Sessions arent working Empier4552 PHP How-To 2 July 9th, 2003 03:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.