Another worthless how-to book?

Other than teaching myself enough html to design simple webpages my knowledge of computer programming stopped with BASIC from the Apple IIc/Commodore Amiga era.

But, I would like to design a presidential election game that could be played online. I’ve tried to teach myself JavaScript and Perl, but I do not know enough about modern computers to get anywhere. I’ve checked books out of the library that will supposedly teach yourself php. But, no matter how new a programming book is, it will be out of date when it comes to downloading and configuring anything needed to make it work is concerned.

But I found Leon Atkinson’s Core PHP Programming 2nd edition at a thrift store. Since it came with a disk I went ahead and bought the book thinking the disk would have whatever is needed to make PHP work on my computer without being online. This book doesn’t even explain how to install the software. I went through the autoplay and installed what is supposed to be Apache for Windows. But running the program only gives me a window that I think is empty; it only flashes on the screen for a second.

Now, I’ve written the 1st program in the book. The book doesn’t explain how to save and run the file, so I assumed that it should be a plain text file with .html like any webpage.

This is the program:

Listing 1.1 Today's Date: <? print(Date("1 F d, Y)); ?>

And “Today’s Date:” is the only output. Have I typed something wrong, or did the book leave something out?

I’ve tried it with an added tag and with <?php the way I have seen on the net, but I get the same output. I’ve also saved the file with a .php the way some online tutorials say to, but this only gives the code for the program as output.

Do I have another computer book that should go to the recycling bin?

Needs a php file extension not html.

You should write the start of php code as

[php]

<?php[/php] not [php]<?[/php]

You need a web server to run PHP, and they are usually configured to only serve PHP in .php files. Please note that it’s recommended to use the full php tag (<?php) and not the short one (<?).

I wrote up a “quick start” on how to get started with coding.
http://www.phphelp.com/forum/the-occasional-tutorial/getting-started-with-coding

This is just my advice, but when looking for a good book don’t go to the bargain bins to save $$$ if you’re serious on learning PHP or any other language for the matter. Those books tend to be either out-of-date or not very good to begin with. My advice try to pickup the latest edition of any programming book. My recommendation is the author Larry Ullman, he has a whole variety of books targeted for beginners to advance coders. I would also avoid old tutorials on the internet, specially the ones that use mysql instead of mysqli or PDO, for that is a red flag that tutorial is obsolete.
Another good way to learn is visiting forums such as these, for you’ll see threads where people fall into these traps and people who are knowledgeable help (or attempt to) them out. Another piece of advice that I have learn over the years is that when you ask for help don’t get uptight if the response is brutally honest. I have in the past spent a whole day developing a script and thought it was the best thing that I had developed, only to be told that I should delete and do something else because the script was a big security hole. It’s a learning experience that taught me that I should check from the start that I’m going in the right direction. Had I been defensive I would still be going down the wrong rabbit hole. That’s why I try to be honest as I can when replying and I also admit that I don’t know everything, by that I mean I don’t get upset if someone with more knowledge gives a better reply or corrects me. For I’m always learning something new myself when it comes to PHP or any other language. Sorry for my soap box. ;D

For what Strider said, PHP books (even new) seem quite out of date even when they roll off the presses.

I do buy out of the bargain bins, but with experience you also learn what to ignore and where the poor practices are.

A first chapter is not completely indicative of a bad book. They tend to build on skills from previous chapters. What book are you currently working with?

The book I am using is Core PHP Programming Using PHP to Build Dynamic Web Sites 2nd Edition; Leon Atkinson, Prentice Hall, 2001; 0-13-089398-6.

I found it at a charity thrift store rather than a bookstore. It’s unusual for a book so old to be in practically new condition like this one is. I only bought it because it still has its disk, which is extremely unusual for anything found in a thrift store. I’m sure I could figure out the code once I know the right syntax. But my biggest problem is that I know absolutely nothing about web servers so even if the disk has whatever I need, I can’t figure it out.

According to the last page in the book these are the files contained on the disk:

Examples.zip and examples.tar.gz
These archives contain all the example code from Chapters 8-14.
Files are named after the function they demonstrate.

Listings.zip and listings.tar.gz
These archives contain the numbered listings from Chapters 1-7 and 15-22. Files are named after chapter in which they appear.

php-4.0.0.tar.gz
This file is an archive of the source code for the final release of
PHP 4, the newest version at time of production. Use it to install PHP on a Unix system.

php-4.0.0-Win32.zip
This file is an archive of a binary distribution of the final release of PHP 4 for Windows operating systems.

apache_1.3.12.tar.gz
This file is an archive of the files necessary to compile the Apache Web server.

apache_l_3_12_win32.exe
This file is a program for installing the Apache Web server on a Windows operating system.

The last file is what I installed. But running the program doesn’t seem to do anything. You get a blank window that flashes for about a second. My operating system is Windows 7.

You can pretty much disregard the entire book. It is so out of date it will cause you more issues.

Try murach php & mysql, current edition.
PHP Advanced and object oriented programming, 3rd edition
Php & mysql, novice to ninja.

Something written no more than 3 years ago is going to be most beneficial.

Also, install something like WAMP or XAMPP . That will handle your local server and give you the needed files and programs in one handy package, I don’t know what you would be installing with the disk, but it is not what you want now.

Id argue you dont want wamp/xampp as well.

Sponsor our Newsletter | Privacy Policy | Terms of Service