Williams and Lane's new 2nd edition of "Web Database Applications with PHP and MySQL" (O'Reilly, 2004) has done it for me. It weighs in at almost 800 pages, a few hundred more than its 1st edition, and it looks like an almost complete rewrite. It covers PDF reporting in depth, installation on Windows and Mac OS X, and has chapters towards the end on PEAR, advanced MySQL, and PHP55 OO features. By the time I bought it, I guess wasn't really a newbie, but I still think it is gentle enough if you're still getting the basics (the first 200 pages or so introduce PHP and MySQL). It's a pretty awesome book, and shows again why O'Reilly are a safe bet (though perhaps it's wise to wait for the 2nd editions, judging by the bugs in the 1st edition of this one).
I reckon both books are worth the money, but if you just want one, then O'Reilly's new book is better.
The first 150 pages or so are on the syntax of PHP. The last 20 of those are on Object Oriented PHP (version 4), and about 10 of those are on the basics of OO programming. So I wouldn't try and learn OO PHP from this book (see Advanced PHP Programming for that.)
Section two, on database programming, starts with an introduction to the basics of database design, moves onto the mechanics of MySQL and it's interaction with PHP. It finishes with a very brief section on PEAR. This is the part that caused me to give the book only three stars. First, the database access uses string concatenation, which is error prone and insecure. Even worse, the section on PEAR, which supports the '?' operator in SQL statements, fails to mention that feature or it's advantages. Since most PHP programming is about putting a face on a database, teaching how to do databases the right way is extremely important. For a lesson in how to do database access in PHP right see another SAMS PHP book; Advanced PHP Programming.
Up to chapter twenty-four the book progresses by talking about each technology (e.g. authentication, date manipulation, regular expressions, etc.) as a sort of stove pipe. The chapters are generally short, and are well written and consistent. Graphics are used sparingly, which is appreciated.
With chapter twenty-four and beyond the author presents common tasks (e.g. login pages, shopping carts, etc.) with example applications. This is an effective technique as most of these problems involve bringing together several PHP technologies and understanding how to use them as a whole.
Overall I liked this book. I did take exception to the SQL problems in section two and I marked my review down because database access is so important to PHP web development. WIth the caveat that the reader should look elsewhere for advice on proper PHP database development I would recommend this book to anyone with some web experience who wants to develop dynamic sites with PHP.
This book focuses on PHP alone and MySQL alone, leaving the integration for it's projects starting about half way through the book. I was dissapointed also on the length of MySQL query language. The section skimmed over MANY of the operators, only explaining about 1/3 of them, and leaving the other 2/3 to learn from months of trial and error. I was thoroughly dissapointed that they even kept things such as joining tables to perhaps 1 sample query and a 2 paragraphs at most. I was hoping to see beyond "SELECT * from table WHERE ID > 5 ORDER by title DESC", but that is about as far as most of this book will take you...
I also found that the coding techniques used are a bit too "orthodox" and not very present day. I say this because they use far too many lines/functions than needed. I've probably learned more from re-writing their code to my style than reading their code in general.
There are only about 1 or 2 coding mistakes (which I've found, however I guess that was a learning experience) that plague this book, so I have to definitely say the integrity is excellent.
If you are looking to start PHP and MySQL I'd reccomend this as a reference book, keep the core learning seperate. I'd reccomend the PHP Bible (which touches on MySQL integration nearly as much as this does..), but I have not yet found THE MySQL book. I'd reccomend the MySQL Bible but it goes far beyond PHP and not into queries as much as it could...
In summary: Learning book? Eh.. Reference book? Sound's more like it..
Some of the best features of this book include:
* Manual Installation of the PHP Engine, installation of MySQL Engine on Windows Platform. It also deals with UNIX platform.
* Crispy introduction to setting up database, tables in MySQL.
* All you need to know about Sessions, Shopping Cart etc.
The authors also try to discuss the newer functions in the current versions of PHP(at the time of writing the book) and point out the deprecated functions at right places in the book.
If you have some knowledge of Server side Scripting and how the Server folder setup is.. then definitely go for this book.
Hats Off to the authors on such a wonderful effort. No where in the book i feel the authors digress from the subject. All the subjects handled, are of definite practical interest.
Thank you.
The source code in the book is functional, with no errors (at least from what I've encountered). The few issues I have thus far are in the later chapters of the book. For the experienced developer, some of the material in the text is verbose and verbatim, it repeats things that are common to developers (security and whatnot), but it's perfect for the beginner. The book goes onto cover basic authentication in Chapter 14, and then details it in a much later chapter. The things I love about the book is that it covers PHP sessions, working with the file system directly (Windows AND UNIX), FTP uploads, and it even shows you how to make your own WebMail page using PHP.
MySQL is aptly covered, the book does not go into detail with SQL, it covers the basic commands such as create database, use database, create table, insert commands, and some basic authentication stuff. It even has a small Apache tutorial in the Appendix.
It's a good book for the beginner, I bought it because I like the format of the book and the examples.
There is a lot to like about this book:
- It covers both core PHP as well as a nice set of add-on modules. After you have read the book, you will hardly need anything beyond the PHP library reference to start producing full-featured apps (no, the book will not turn you into great programmer).
- Unlike a lot of books in this fast-paced world, it is not a book on PHP 3 that was hastily re-branded for PHP 4 by adding a bunch of footnotes describing changes. This is a book about PHP 4 and it describes and uses PHP 4 features.
- The example projects are realistic enough in size and usefullness yet not overwhelming. I liked a lot the discussion on website roll-out and maintenance - something most of the books on web programming omit. This section will beinvaluable for those who start using PHP for home projects.
As usual, the book is not perfect. There is not much to complain and the issues are not too bad (other books are worse).
- There is very little space devoted to serious issues like PHP and MySQL security - about 3 pages all in all. MySQL optimization and performance analysis get same treatment. Yes, both subjects are quite broad and each of them requires a book on its own. Still, providing checklists and useful tips on both subjects would help raising awareness of the issues, especially for people who don't have any background in web server or database configuration.
- While the book has a lot of information on authentication, it is still unclear after reading it, how one would use basic authentication from PHP. The only half-page example is far from obvious and ther is not much commentary on it.
- When checking for existance of a presumably unique record in a database, authors consistently check whether the number of rows returned is bigger than zero. This is not what I call defensive programming - if they expect the record to be unique, they should check that it is unique indeed.
These tiny issues notwithstanding, I consider it the best "not for Dummies" book on the subject. Not only that, this book immediately fell into the category of the books that I keep, so it now proudly stands on my shelf. Great job, Luke and Laura!
i) It kick off well enough if you have fundamentals in programming and html.
ii) Onwards, it talks about MySQL database and other web security issues..... great explanations without doubts.
iii) And the best thing about this book is after everything, it includes a project sections whereby a lot of interesting web
applications are introduced.
There are also recommendation on how to extend the project further and the authors also intro to you an existing open
source application of that web app type.
I would say this is marvelous not many programming books out there actually have so many different features.
2 thumbs up for these effort.
However, what i dislike about the book is also in the project section. Why did i say that?
First of all, the style of explaning the coding is already in the wrong direction.
Take for example, the authors like to include common functions from other files.
This is a good practice but should be used sparingly.
But what frustrated me most is that instead of explaining page by page, the authors chooose to explained them function by function.
Now, these functions are all over those included files.
You have to jump here and there from files to files to find those functions.
Worst still, in the book there is no printed page of those included files.
The authors assume you will go and search for them in the CD itself.
So, you now know how hard it is to actually search and learned at the same time whats going on in the project.
*ONE IMPORTANT THING*
To address someone's mentioned problem on the shopping cart example....
I see that you can't get any categories to display after querying the database.
Possible reason for the cause might be... you haven't change the password connecting to your mysql database.
Here's the solution:
1) In db_fns.php, there's a db_connect() function
2) Look for this line:
$result = @mysql_pconnect("localhost", "book_sc", "password");
3) Now, remembered in the earlier page of this chapt. the author mentioned that you should changed the mysql database password for this user.
4) Go ahead and edit that line by changing the password String to the password you set earlier for the user.
5) Now, your php script should display the categories.
The reason why this happens is because the authors never bother or forgot to explain this function in the book
and remind you to change the password again.
(remember they are skipping all over the functions)
Overall, this is a good book for beginner to intermediate if you do not mind debugging the codes and the typos.
However, do not expect great aftersales support from the publisher and authors.
BTW, the errata for 1st edition is at http://www.tangledweb.com/errata.php
and its not really updated if you asked me.
Another thing that irked me about this book is the fact that the writer did not bother to tell you everything you should compile into PHP in the appendix. Instead you set it up as per the appendix and start reading. Then find out you need to reconfigure to add support for something. Reconfigure, recompile, retest - ok start reading again. Doh! Have to reconfigure again to add support for something else. Blah Blah - this happens about 4-5 times. Great.
Arggggg - OK - I have a headache from reading this book. I would not recommend it unless they come up with an errata or a third edition with fixed code and the correct install instructions for PHP.
Enjoy!
I've had the book for a few days now and I was looking forward to giving it quite a high mark and a general thumbs up all round.
But unfortunately I've just discovered something which (in my mind) ABSOLUTELY *ruins* this entire book. The trouble is this...
When you're writing PHP scripts you can (as I'm sure many of you are aware) use "include" files to save you from re-writing certain sections over and over again. But the trouble with this book is that the programming style goes WAY overboard with the include files.
For example, in the online shopping cart program that's discussed, if you look at the book, then the script looks fairly short and refreshingly simple. "Great!"- I hear you say. *BUT* if you look closely you'll notice that the program has a line which basically says "include such and such a file".
Ok, so now you have to cross reference two separate scripts. That's a bit of a pain, but you're probably still not too bothered and eager to carry on with the book. *BUT* dig this! When you go to that include file, it's filed with lots and lots of other include files!!!!!!!
To make things even worse, the include files that you get on the CD are just massive horizontal blobs of text. The authors didn't even bother to hit return at the end of each line!!! HOW LAZY IS THAT??????!!!!
And by the way... everything that I've described so far is just for one tiny part of the shopping cart program (the "display item" page). If you were seriously thinking of building the entire online shopping cart program from scratch then you can conseravitely multiply the above process by 20 or 30!
It's just a mass of confusion!
Oh, and don't think you'll be able to figure out what's going on from the book- the book doesn't even discuss most of the include files!
So, all of this means that if you *really* wanted to work out how to build an online shop from this book, then you'd have to spend literally weeks (perhaps even months!) untangling the massive ball of string that is all the include files. What a terrible way to write a book about programming!
This reason alone renders this book useless. Not poor. Not badly written. USELESS! I'd even go so far as to say it's almost as though the authors are really paranoid about the idea of other people actually learning how to build professional PHP applications!
This book SHOULD have been a four or a five. A face value it has everything going for it. But the bottom line is, if you want to learn how to build PHP applications, it'll do nothing but slow you down.
There are many other great PHP books here on Amazon.
I advise you to forget this particular book and move on.
It gives a quick and clear intro to the foundations then leaps into some great code with lots of useful practical examples. The text is clear and very easy to follow especially of you who have had any programming experience before.
After having a look at the other books around I would recommend this to people who want to move up a rung on their skill ladder or to beginners with some programming experience in C, VB or Java wishing to get into PHP.
It gives a quick and clear intro to the foundations then leaps into some great code with lots of useful practical examples. The text is clear and very easy to follow especially of you who have had any programming experience before.
After having a look at the other books around I would recommend this to people who want to move up a rung on their skill ladder or to beginners with some programming experience in C, VB or Java wishing to get into PHP.