Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
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 8th, 2004, 01:19 PM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with the books code...?

Hello everyone. I just picked up this book this weekend and have started to read through it and do the examples. However, I have run into a problem.

Every example that I have done for chapers 3 and 4 have not worked correctly. I also downloaded the code from here, uploaded it to my web server and tried executing it as well...still had errors.

For instance, on the holiday example. I followed everything to the letter and I can not get it to work correctly. It keeps telling me I did not select a value for the hotel, but I did...

This has me concerned about the book now.
Has anyone else been having these problems?

Tarballed

 
Old June 8th, 2004, 01:58 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I think you probably need to turn register_globals on in php.ini or else refer to the POST variables with $_POST and GET with $_GET.

HTH,

Snib

<><
 
Old June 8th, 2004, 02:03 PM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Snib
 I think you probably need to turn register_globals on in php.ini or else refer to the POST variables with $_POST and GET with $_GET.

HTH,

Snib

<><
That did it...I must have missed that part somewhere in the start of the book im guessing?

Also, when I was editing the php.ini file, it said that turning on register_globals was not such a great idea. Since i want to make sure I write good, secure code, would it be better to use the POST variables?

I'm new to PHP (and programming for the most part) so I have a lot to learn.

I appreciate it.

Tarballed

 
Old June 8th, 2004, 02:14 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

OK, here is the thing with this book: it uses PHP3-ish (fancy word) code and techniques, some of which don't apply to PHP4, such as the register_globals thing. In PHP3 register_globals is on by default, but not in PHP4.

THE BAD THING ABOUT REGISTER_GLOBALS:
Say you have a page, index.php, that uses a session called $username to validate users. Well, if the user types in http://wherever/index.php?username=me then they can get in, because $username looks at the querystring, too.

I hope I haven't lost you here.....

The bottom line: yes, register_globals is a bad idea. Bad.

So if you had a form like so...

<form method=post action=thispage.php>
<input name=thisthing type=text>
</form>

...you would get the textfield with $_POST['thisthing']. Changing the form's method to GET then $_GET['thisthing'] would get it (method=get puts the form elements in the querystring).

Hope this clears things up a bit.

Snib

<><
 
Old June 8th, 2004, 03:21 PM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Snib
 OK, here is the thing with this book: it uses PHP3-ish (fancy word) code and techniques, some of which don't apply to PHP4, such as the register_globals thing. In PHP3 register_globals is on by default, but not in PHP4.

THE BAD THING ABOUT REGISTER_GLOBALS:
Say you have a page, index.php, that uses a session called $username to validate users. Well, if the user types in http://wherever/index.php?username=me then they can get in, because $username looks at the querystring, too.

I hope I haven't lost you here.....

The bottom line: yes, register_globals is a bad idea. Bad.

So if you had a form like so...

<form method=post action=thispage.php>
<input name=thisthing type=text>
</form>

...you would get the textfield with $_POST['thisthing']. Changing the form's method to GET then $_GET['thisthing'] would get it (method=get puts the form elements in the querystring).

Hope this clears things up a bit.

Snib

<><

Ahh...Ok. I understand most of what you are saying. :) Still learning, but im having a good time at it.

I'm an OS guy by default (*BSD, Linux, HP-UX) and have been putting off learning programming for awhile. Now, some projects have come up for the company that I work for and im going to be working a lot with PHP, MySQL and PostgreSQL...

I know I have a lot on my plate, but that's ok. Learning is a blast. If I could ask for your thoughts, do you have any recommendations for books that teach using PHP with databases? Figure, mine as well starting building my library now.

I appreciate it.

Tarballed

 
Old June 8th, 2004, 03:46 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

I have few Wrox books, but I hear great things about most of them. The PHP ones, however, are a bit outdated.... can't wait 'till they come out with the next versions!

I like books, but I haven't seen any outstanding PHP ones, I guess because PHP is easy to teach yourself with the manual.

I'll let you know if I find anything, and I suggest you look at reviews at amazon.com.

Snib

<><
 
Old June 8th, 2004, 05:37 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default


Beginning PHP, Apache, MySQL Web Development
is the newest Wrox PHP book, I suggest starting there.. and it is not yet outdated.

Secondly register_gloabls is a bad thing for several reasons, besides its security issues its a deprecated directive, meaning that at some point it will be removed from PHP.

Read up on this, as we've answered hundreds of questions about it:
http://www.google.com/search?q=regis...e:p2p.wrox.com

And Nik's FAQ:
http://p2p.wrox.com/archive/beginnin...2002-11/17.asp

HTH!


Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::
 
Old June 8th, 2004, 05:48 PM
Friend of Wrox
 
Join Date: Nov 2003
Location: , , .
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Forgive me about the outdated comment Rich, I've seen so many register_globals problems with this book (actually it's the same problem many times) I can't keep track of them (and I don't really bother :)).

Snib

<><
 
Old June 14th, 2004, 02:27 PM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by richard.york

Beginning PHP, Apache, MySQL Web Development
is the newest Wrox PHP book, I suggest starting there.. and it is not yet outdated.

Secondly register_gloabls is a bad thing for several reasons, besides its security issues its a deprecated directive, meaning that at some point it will be removed from PHP.

Read up on this, as we've answered hundreds of questions about it:
http://www.google.com/search?q=regis...e:p2p.wrox.com

And Nik's FAQ:
http://p2p.wrox.com/archive/beginnin...2002-11/17.asp

HTH!


Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::

I appreciate the feedback. I have been working with apache for awhile, so I am very comfortable with installing, setting up, configuring etc. The two im working on now are PHP and MySQL.

Just curious, I found this book on Amazon.com and thought about buying it, but I wanted to ask here first, and see what the concensus was about it and whether it would be a good thing or bad thing:

Beginning PHP4 Databases

Just thought I would ask.

Tarballed

 
Old June 16th, 2004, 04:12 PM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

Beginning PHP 4 Databases is a little outdated, the examples are written around something called register_globals (long deprecated and bad PHP programming practice), and this is no longer a Wrox book, Wrox went bankrupt some time ago and was purchased by Wiley, at that time Wiley only purchased some of the Wrox catalog, the rest were purchased by Apress, this book was one of them.

I would still get "Beginning PHP, Apache, MySQL Web Development", this doesn't focus hugely on Apache.. the content is largely PHP and MySQL.. if you have a question about the book several of its authors participate in the forum for the book.

That forum is located at:
http://p2p.wrox.com/book-asp-net-website-programming-problem-design-solution-23/0

Regards,
Rich

::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::




Similar Threads
Thread Thread Starter Forum Replies Last Post
I cant find code PHP4 Professonal books. Jonix Wrox Book Feedback 19 December 9th, 2005 03:11 PM
Code Problems mrnick Beginning PHP 9 January 2nd, 2004 05:37 PM
Problems With New VBA Code Ben Horne Access VBA 4 September 22nd, 2003 07:19 PM
Code Problems sethtrain BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 1 June 25th, 2003 10:48 AM





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