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 June 11th, 2008, 12:35 PM
Registered User
 
Join Date: Jun 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 3 Session Problem in example

Hello....
[Beginning PHP5]

I don't know if i did something wrong or the program really doesn't work
i type the code written on the book... so far so good to the other programs.. but when i reach to the sample program name "Count Page Accesses Page 118 Chapter 3" there is this always an error saying

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in C:\xampp\htdocs\practise\sessions.php on line 15

here is the code i've been working out

Code:
<?php
session_register('view1count');
session_register('view2count');
session_register('view3count');
session_register('view4count');
?>
<?php
echo "<html><head><title>Web Page Hit Counter </title></head><body>";
if(isset($_GET['whichpage'])){
    echo "<b> You are currently on page $_GET[whichpage].</b><br><br>\n";
    $_SESSION["view".$_GET['whichpage']."count"]++;
    }
for ($i=1;$i<=4;$i++){
    if(isset($_GET['whichpage'])==$i){
        echo "<b><a href=\ "sessions.php?".session_id()."&whichpage=$i">Page $i</a></b>";
        }
        else{
            echo "<a href=\ "sessions.php?".session_id()."&whichpage=$i">Page $i</a>";
            }
            echo ",which you have chosen ".$_SESSION["view".$i."count"]."times.<br>\n";
    }
echo "\n\n<br><br>\n\n";
echo "</body></html>";
?>
THIS IS THE LINE 15 THE BROWSER IS MENTIONING
echo "<b><a href=\ "sessions.php?".session_id()."&whichpage=$i">P age $i</a></b>";


Please Help Out Here..
Thank you very much






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 15: using session variable ftor BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 0 August 9th, 2007 01:30 AM
2nd chapter session question infernon BOOK: Beginning PHP5, Apache, and MySQL Web Development ISBN: 978-0-7645-7966-0 1 March 14th, 2007 12:07 PM
Chapter 15 Session variables mcauliff BOOK: Beginning ASP 3.0 3 December 9th, 2005 05:12 PM
session problem. rupen Classic ASP Basics 2 June 7th, 2005 10:50 PM
session and cookie problem (empty session file) msincan BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 February 27th, 2005 05:31 PM





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