Wrox Programmer Forums
|
BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5
This is the forum to discuss the Wrox book Beginning PHP4 by Wankyu Choi, Allan Kent, Chris Lea, Ganesh Prasad, Chris Ullman; ISBN: 9780764543647
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 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 August 28th, 2003, 04:57 AM
Registered User
 
Join Date: Aug 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chap13 page 474

why do i keep getting

Parse error: parse error, expecting `'{'' in /usr/local/www/common_db.inc on line 12

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /usr/local/www/common_db.inc:12) in /usr/local/www/user_auth.php on line 57

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /usr/local/www/common_db.inc:12) in /usr/local/www/user_auth.php on line 57

these types of error always occur with most examples.

Any Help?

 
Old August 29th, 2003, 09:44 AM
Authorized User
 
Join Date: Jul 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you wrote the common_db.inc, I'd look around line 12. The errata page has the following:

http://www.wrox.com/books/errata/076...4_errata.shtml

Code Error in common_db.inc
common_db.inc is missing a closing PHP tag ie ?> at the end of the script.

Good luck,
Oregon
 
Old August 30th, 2003, 02:23 PM
richard.york's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Quote:
quote:
Parse error: parse error, expecting `'{'' in /usr/local/www/common_db.inc on line 12
Means that PHP expects an opening curly brace.. I would review the code to see that you haven't inadvertaently missed including a curly brace, which is a common typo.

Quote:
quote:
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /usr/local/www/common_db.inc:12) in /usr/local/www/user_auth.php on line 57
session_start(); automagically sends out a cookie upon being called. The session_start(); function must be called before any headers are outputted to the browser because this cookie is sent within the responding HTTP headers and this must happen before your script generates any output.

See also:
http://us3.php.net/manual/en/function.session-start.php

That means that there cannot be any whitespace before the opening '<?php' delimiter and it also means that your script cannot have any output before this function call is made, i.e., echo or print statements sending opening HTML tags, anything at all!

If you want your script such that you may include session_start(); pretty much anywhere that you like, call this function as the very first statement:

# output buffer start
ob_start();

and this function as the very last

# flush and send the output buffer
flush();

These two functions will create an output buffer so that your script does not output any data until the flush(); function call is made making it just fine to call on setcookie() or session_start(); or header(); ect. anywhere that you like within a script as long as the call is between these two functions.

See also:
http://us3.php.net/manual/en/ref.outcontrol.php

: )
Rich


:::::::::::::::::::::::::::::::::
Smiling Souls
http://www.smilingsouls.net
:::::::::::::::::::::::::::::::::





Similar Threads
Thread Thread Starter Forum Replies Last Post
C# Chap13, Checkout (Last Exercise) onlinecg BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 February 20th, 2008 05:49 AM
access C#.Net page as action of calssic ASP page mansharma_s ASP.NET 1.x and 2.0 Application Design 6 January 7th, 2008 10:58 AM
Page 468-474 Chapter 13 michaelcode BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 July 24th, 2006 09:00 AM
How to pass variables from Aspx page to Asp Page jayaraj Classic ASP Basics 2 May 23rd, 2004 06:56 AM





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