Wrox Programmer Forums
|
BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9
This is the forum to discuss the Wrox book PHP and MySQL: Create-Modify-Reuse by Timothy Boronczyk, Martin E. Psinas; ISBN: 9780470192429
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 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 3rd, 2009, 07:08 AM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default ch 1 'main.php' code wrong

The code for 'main.php' is supposed to send an email to the logged in user reminding them of their password

However the page does not display the logged in users details in stead it shows the first entry in the user database, see code below

// generate user information form
$user = User:: getById(1);
ob_start();

Any help with calling the user ID for the current session to relace the 'getById(1);' which is useless would be most welcome.
 
Old August 3rd, 2009, 07:39 AM
Registered User
 
Join Date: Aug 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

just had a look at the book it seems to contain the right code compared with the downloaded code, but doesint seem to work as no username is displayed in the username field.

$user = User::getById($_SESSION['userId']);


Got it!
No
'session_start();'
was included in the file which is needed

Last edited by danb100; August 3rd, 2009 at 07:58 AM..
 
Old September 5th, 2009, 10:54 PM
Registered User
 
Join Date: Sep 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default session_start() in 401.php

I also wasted time dealing with the same errors: the book code for main.php is more correct than the download version. session_start() is in 401.php which is included in main.php, so you don't have to add it in again, but the line including it was commented out in the download version.





Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP 5, Wrox, CH 7 navigator.php Jon_ BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 August 24th, 2008 01:13 PM
Beg. PHP 5 > Ch. 11 - fetch_field.php crater BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 January 2nd, 2007 12:20 PM
CH. 14 cart.php code problem shawnrberg BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 2 June 21st, 2004 05:44 PM
Ch. 1: PHP Installation Troubles: php3 vs php manjito BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 4 June 12th, 2003 03:59 PM





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