BUY THIS BOOK
Add to Cart

PDF $20.99

Safari Books Online

What is this?

Looking to Reprint or License this content?

Learning PHP and MySQL

By Michele E. Davis, Jon A. Phillips
First Edition  June 2006 
Pages: 376
ISBN 10: 0-596-10110-4 | ISBN 13: 9780596101107
starstarstarstarstar (Average of 16 Customer Reviews)

This book has been updated—the edition you're requesting is OUT OF PRINT. Please visit the catalog page of the latest edition.

The latest edition is also available on Safari Books Online.

Book description

Featuring basic concepts explained in plain English, Learning PHP and MySQL is the ideal guide for newcomers attracted to the popular PHP and MySQL combination. Learn how to generate dynamic web content in a slow, easy-to-follow fashion. Also covers error handling, security, HTTP authentication, and more. Part of O'Reilly's bestselling Learning series.
Full Description

The PHP scripting language and MySQL open source database are quite effective independently, but together they make a simply unbeatable team. When working hand-in-hand, they serve as the standard for the rapid development of dynamic, database-driven websites. This combination is so popular, in fact, that it's attracting many programming newbies who come from a web or graphic design background and whose first language is HTML. If you fall into this ever-expanding category, then this book is for you.

Learning PHP and MySQL starts with the very basics of the PHP language, including strings and arrays, pattern matching and a detailed discussion of the variances in different PHP versions. Next, it explains how to work with MySQL, covering information on SQL data access for language and data fundamentals like tables and statements. Finally, after it's sure that you've mastered these separate concepts, the book shows you how to put them together to generate dynamic content. In the process, you'll also learn about error handling, security, HTTP authentication, and more.

If you're a hobbyist who is intimidated by thick, complex computer books, then this guide definitely belongs on your shelf. Learning PHP and MySQL explains everything--from basic concepts to the nuts and bolts of performing specific tasks--in plain English.

Part of O'Reilly's bestselling Learning series, the book is an easy-to-use resource designed specifically for newcomers. It's also a launching pad for future learning, providing you with a solid foundation for more advanced development.

Browse within this book

Cover | Table of Contents




Featured customer reviews

Write a Review


Geez... Did anyone edit this?,  July 08 2007
Rating: StarStarStarStarStar
Submitted by Matthew Hale   [Respond | View]

I'm trying to learn PHP and MYSQL, and I have loved every other O'Reilly book I've read, so I didn't hesitate to order Learning PHP & MySQL. I should have read the reviews. Although the structure and general strategy for teaching seems sound, there are SOOOOO many errors and awkward sentences it's unbelievable. When I started working my way through it I printed out the errata pages, and just today I got stuck on a page. After an hour or so of frustration I came back to the errata listing online, and there are NEW entries. So if you do buy this one, and get stuck, check back often!


Disappointing,  June 03 2007
Submitted by Ioan Bach   [Respond | View]

I have done some fairly basic web site maintenance in the past but felt that the time had come to investigate all the good things that PHP and MySQL could do for me. I therefore bought this book in the hope and expectation, based on previous experiences with many excellent O'Reilly publications, that it would be class leading. Unfortunately it doesn't measure up.
In fairness I started off knowing very little about MySQL and nothing at all about PHP whereas now I am able to utilise some basic elements of both. However I felt really annoyed that the code examples, some of which appear to this beginner to have errors, depend upon Smarty and PEAR being installed. In my view it is perfectly acceptable to mention these add ons - even devote a chapter each to them - but it is more irritating that I can say to find that I cannot really work my way through the examples because of their dependency upon these packages, packages that are not and will not be installed on the server that I have to use.
As others have remarked, the writing style is sometimes a little difficult to follow.
Some suggestions for the second edition - yes, it does merit a second edition:

Would I recommend this book? It would be hard to do so in its present form.


Very disappointing,  May 02 2007
Rating: StarStarStarStarStar
Submitted by joe_exp   [Respond | View]

Don't know where to begin; There's typos all over the place; PHP scripts don't work the way they are printed in the book; It's like know was proof-reading this book; Very frustrating experience. Wouldn't recommend it to my worst enemy!

Read all reviews


Slogging through it,  April 24 2007
Rating: StarStarStarStarStar
Submitted by barry   [Respond | View]

I, too, have read and recommended the O'Reilly series as the best for all levels of novice and expert. However, this book is poorly written/edited, and I don't just mean technically. Aside from many code errors, the sentences themselves are often awkward and confusing. I've only read a few chapters so far, but I'm slogging through it because I want the information that the book promises, and there seem to be other readers who have gotten something out of it. Fortunately, I know enough to be able to tell when the book is being confusing. I would feel bad for a beginner to pick up the book and feel that the subject is too hard to understand, when it's really the language and organization of the information that is hard to understand. I compare it especially to the last O'Reilly book I just read, "Learning SQL", which was clear, concise, friendly, and moved along nicely from topic to topic. This current book seems to jump around from place to place, where each coding example doesn't follow from the one before it. I'm hoping that the book may be redeemed by some of its later chapters.


Well below the usual O'Reilly good quality,  April 01 2007
Rating: StarStarStarStarStar
Submitted by rhicReader   [Respond | View]

I have bought many O'Reilly books in my time and generally find them to be good to excellent in quality. This is the first O'Reilly book which I would not recommend to a friend. The previous reviews have already pointed out the problems. As an example, I found this WWW site in the introduction (page xii) which indicated that there would be "listed errata, examples, ..." The errata are here, but where are the examples which would save one typing? So instead of reading about examples, I will write a review and possibly help some other Mac OS users who bought the book.

As one reviewer has already remarked, the Mac OS user is poorly served by the meager instructions in the "tip" on page 23 about getting PHP to load in the Apache configuration file. I never did manage to find the httpd.conf file, not at least until I went to a PHP5 web site (http://www.entropy.ch/software/macosx/php/) which told me all I needed to know about installing the newer PHP5 and pointed out where the httpd.conf file is located (/etc/httpd/httpd.conf) for Apache in the Mac system. Turns out that this PHP5 installation, replacing PHP4, automatically sets up Apache for accepting php files, and it was better not to have modified that httpd.conf anyway.

No point in recounting the errors, but I would advise users of the book to print out the error pages, to avoid unneeded head-scratching. My own favorite error is the Figure 3-3 on page 39 which attempts to illustrate the scoping idea (I already knew this concept as a C++ progammer) . The variable $age=30 is assigned, and then a "Birthday() function is schematically indicated with an $Age=1 assignment. Lastly there is an echo $Age command. Just two pages previously the text points out that variables in PHP (as in C/C++/Perl, but not Fortran for those who remember) are case sensitive. So these are two different variables, and scoping would not matter. The top pointing arrow in the figure ("Value of $age comes from here") is somewhat poorly aligned, but seems to refer to the $age variable, while the bottom arrow refers to the $Age variable. So the figure really doesn't make the point about scoping (two different variables) and has an error in the $echo of an undefined variable.

Clearly O'Reilly's proof readers and editors were asleep when checking his book. If there is ever a second, improved edition, I would like a free copy.


Couldn't get off the ground on a Mac.,  March 01 2007
Rating: StarStarStarStarStar
Submitted by Douglas Cleary   [Respond | View]

I am not a novice programmer, but I am trying to expand the areas of my knowledge. Upon recommendations of others, I have decided to learn PHP and especially how it integrates MySQL. On the shelf at Borders, this looked like an excellent choice. It seemed to be an easy introduction to PHP and promised to provide a balanced discussion of Win, Mac & Linux differences.

Once home I pulled out my MacBook (2007) and went through chapter one and started chapter 2. The issue of installing Apache was simple. It comes pre-installed on Macs. Moving on to installing PHP I skimmed over the 3 pages on Win installation info until I got to this sentence:

"If you are on Mac OS X, you have PHP preinstalled on your computer. You need to edit the Apache Configuration file to enable PHP in much the same way you edited the PC file." [p. 23, para. 4]

That was the entire discussion of installation (or should I say activation) of PHP on a Mac. I flipped back the three pages and put on my rusty Win hat and read the section in detail. I tried to use Spotlight to find "httpd.conf" but to no avail. (Apparently this file is hidden from Spotlight, a small detail the author might have wished to include.) The suggestion that it is "typically found in C:\Program Files\Apache Group\Apache2\conf\" was not very help to a Mac user. I spent the next hour and a half looking for the right directories and files with no success. I then thought to look on the O'Reilly site to see if there was an errata sheet that might provide guidance. There was none! However, there were numerous reviews and they were all bad.

I am not going to demand O'Reilly give me my money back. Instead, I'm heading back to Borders right now and return it. Maybe I'll buy one of three other titles that had good reviews (for those looking something else they are PHP Cookbook, Learning PHP5, & Web Database Applications with PHP & MySQL.) Maybe I won't. Maybe I'll try one of the other publishers' book. However, the editor who approved this book should be fired.


Setting editing aside, I like the book.,  February 28 2007
Rating: StarStarStarStarStar
Submitted by max.b   [Respond | View]

I am not new to programming, but new to PHP. I am comfortable with SQL, but have not worked with MySQL before.

I got a project that requires PHP forms and MySQL database programming. Needed a book to quickly jump in and bring myself up to speed on the technologies involved.

While I find this book to be a little too basic in some cases, I find it a great way for me to start designing database schemas, coding forms, processing forms with PHP and communicating with the database.

For the content itself, I'd give it a 4.5 out of 5.

There are, however, many errors. Too many errors. I am surprised that this book was published the way it is. In one instance the ending of one page did not match with the beginning of the next page. Sometimes code examples are mistyped or wrong variables are used. It appears that noone did any proofreading of this publication.


For that reason, I cannot give the book a rating higher than 2.


Incredibly Bad Show,  February 25 2007
Rating: StarStarStarStarStar
Submitted by James Aldridge   [Respond | View]

This book has a huge number of errors in it.

I should be offered a refund.


Glad to see that I wasn't the only one disappointed by the non-existent editing...,  January 29 2007
Rating: StarStarStarStarStar
Submitted by Anonymous Reader   [Respond | View]

I really was astounded by the frequency of errors throughout this book. I had started to highlight errors in red, but gave up when the book looked as though I had an arterial bleed all over it. It is definately the worst "Learning..." book I've ever read from Oreilly. All registered 'owners' of this book should be offered a free replacement when a corrected version is printed...


editing?,  January 13 2007
Rating: StarStarStarStarStar
Submitted by duadox   [Respond | View]

How can a major publishing house drop the ball so bad in terms of copy editing and proofreading. The book reads as if nobody even bothered with these tasks. And why is the first edition still in the bookstores? Why is it still being sold? Where is the new edition with all the corrections?


I feel so violated,  December 17 2006
Submitted by prok   [Respond | View]

I can't describe how disappointed I am with this book... but I'll try anyway.
I too stumbled across more than a few mistakes early in the book, at first I was encouraged that I was smart enough to even notice and therefor ignore and work through.
However, the mistakes continued and eventually the enevitable happened: I reached chapters that were completely new to me (having no php experience hence why I bought the book).
I jumped into this book with the same, if not more enthusiasm I approach all my design and coding with only to end up discouraged and confused.
I don't know much about writing books but I'm of the opinion that authors or editors have a responsibility to their readers.. I felt confident in buying the book because I trusted the name, now I'm going to second guess every o'reilly book I consider.

[t][h][:][s][b][o][o][k] = ripoff




This book is poor quality,  November 27 2006
Rating: StarStarStarStarStar
Submitted by Noel Byrne   [Respond | View]

This book is very poor quality. It is obvious that the internal O'Reilly reviewers did not review the document properly as there are so many errors of every type. Some sentences don't even make any sense. Some sentences say exactly the opposite to what they should say. Code examples are sometimes wrong.

As an experienced programmer, I can see the mistakes easily, and ignore them, but I think it is very unfair to real learners to give them a text like this, as I think the many errors will cause them real problems. I think O'Reilly should recall this edition until the problems are sorted.


Nothing to add to previous reviews: This Book is not Worth your Money,  November 21 2006
Rating: StarStarStarStarStar
Submitted by Will Christopherson   [Respond | View]

I don't know what the professional reveiwers were reading when they wrote accolades about this book.

From the very start, it's obvious this book is severely lacking in professional editing. I'm on page 44 and I've already found 10 editorial errors! My favorite is on pg 44 where it shows a graphic illustrating how a string works - "[t][e][s][t][:][n][g] = testing" {sic} Yes, that is a colon. How in the WORLD did they miss that? It's at least 18 point font on the page! It's just a shining example of the editorial trend this book has shown.

The writing is nothing to praise either. The beginning of Chapter 3 says,
"Since you haven't done any programming, we understand that variables are a new concept."
Later on, while talking about super global variables in PHP, the author writes:
"The older super global variables such as those starting with $HTTP_* that were not in arrays still exist, but their use is not recommended as they are less secure."
Obviously the author cannot decide what audience to write for. Beginners, or someone with PHP experience who will understand that last quote? The direction of the writing could confound beginners, and the book is not geared to anyone else.

Often confusing and poorly edited, this book should not be your first resource for PHP and MySQL. If you are determined and clever, you should be able to decipher what the book is trying to tell you - but look elsewhere unless you enjoy doing that sort of thing while trying to learn a new concept.


Don't wish to be impolite, but I'd like a full refund..,  November 21 2006
Rating: StarStarStarStarStar
Submitted by Anonymous Reader   [Respond | View]

I bought up this book thinking it would be as good as the other 2 O'Reilly books I have but have been frustrated and disappointed.

The book is sloppily written (check the large number of typos and errors and there's more not listed on this site) and it demonstrates poor coding practices for those trying to learn proper ones - brackets are placed haphazardly throughout, there's different spacing for the supposedly same syntax in different scripts (this is explained away at the end by saying 'indentation is a personal choice' - what about consistency?).

The prose is obtuse and difficult to follow and some is just facile. For example this paragraph is followed by a heading and then a redundant paragraph...

'Since we haven't given you much tangible, sink-your-teeth-into-it PHP code, we're going to give you a great example of how PHP can easily create a conversion tool. Using conversion tools, you could convert from Fahrenheit to Celsius, or U.S. Units of Measurement to Metric. Pretty cool, huh?’ [authors' vernacular]

‘Building a Feet-to-Meters Converter in PHP..
We're going to show you the power of PHP by creating a feet-to-meters converter application which would be handy of your web site is used internationally.'

And while the book doesn't feature the absurdities of 'expert' Larry Ullman's effort, these authors don't seem to know HTML (let alone XHTML and CSS) either. They cover their lack of expertise in this (what I'd consider vital) area with a recommendation to use 'Templates'...

'Templates separate the HTML code that defines the presentation or look of a page from the PHP code that's responsible for gathering the data. Once separated, it becomes easier for someone [apparently not these authors] with HTML and perhaps CSS knowledge to modify the template without worrying about breaking the PHP code. Likewise, the PHP code can focus on the data instead of getting caught up in presentation details.'

HTML is not a presentation language - that's what CSS is for.

And, if PHP is a language for joining strings of text together to make web pages - how can you write about it and not understand such basics? Many of the scripts output strings with just <br /><br /> (ie misused XHTML syntax) to create 'double' line breaks and then others switch to uppercase HTML(4?) syntax with <TABLE BORDER...

But then the authors give semantic web design advice on how to use the fieldset 'tag' to 'logically define a set of data'.

I can't question their knowledge of PHP/MySQL, but this book doesn't appear to have been edited technically or otherwise.


Weak writing, none editing,  November 09 2006
Rating: StarStarStarStarStar
Submitted by Wendy   [Respond | View]

Since you haven't done any programming, we understand that variables are a new concept.

I haven't? They are?

A variable stores a value, such as the text string "Hello World!" or the integer value 1. A variable can then be reused throughout your code, instead of having to type out the actual value over and over again for the entire life of the variable, which can be frustrating and tedious.

What a persuasive scenario. I'm sold.

Okay, so the level is a little too beginner for me. The paragraph on Audience could have been more helpful on this, but fine, I'll choose something more advanced.

But then, a book targeted at beginners is the last place to get sloppy with writing and editing. A quick example of the kind of carelessness that wastes a learner's time:

They can hold characters and strings, or an ordered list of characters.

This makes "an ordered list of characters" look like a third option, rather than giving a definition of a string. It would have made more sense as: They can hold characters and strings (an ordered list of characters).

Like others have said I, too, am feeling bamboozled by my blind faith in O'Reilly quality.

Oh, well. When its time is up, I'll just replace it on my Safari bookshelf with something better. Had I paid for the print version of this book, I would be pretty sad.




A Bit of a Shock,  October 29 2006
Rating: StarStarStarStarStar
Submitted by Hasdrubal   [Respond | View]

I have come to blindly expect a high standard from O'Reilly. "Learning PHP and MySQL" gave me a bit of a shock.



This really is not a good book, and I consider the thirty dollars Canadian that I spent on it to be wasted.



Buyer beware




Seriously flawed,  October 19 2006
Rating: StarStarStarStarStar
Submitted by Anonymous Reader   [Respond | View]

I have been reading this book on Safari and have found enough errors in it to say that it is more frustrating than helpful.
The Apache, PHP, and MySQL installation instructions are extremely flawed. The PHP installation instructions in particular are very frustrating.
The sentence immediately before 8.2.3 speaks of the importance of creating tables and says it's where the book is headed. Then the first sentence of 8.2.3 starts with "Once you've created a table..." This was beyond frustrating.
Simply put I do not believe this book was adequately proofread by a technical editor, and it does not live up to O'Reilly's typically high standards.



Don't buy the first edition.,  August 08 2006
Rating: StarStarStarStarStar
Submitted by Anonymous Reader   [Respond | View]

When I first saw this book advertised I was excited about it because (1) it combined two topics I wanted to learn about, (2) it was brand new and up to date, and (3) it was published by O'Reilly, usually an indicator of high quality.

What a huge disappointment it turned out to be, mostly because it's so poorly written. The authors feel obliged to mention every concept they've ever heard of but don't follow up and explain them; for example, under the heading "Expressions" we read that, "Operators can also be overloaded, which means that they do different things in different contexts." And that's the end of overloading in this book. If you're not going to explain overloaded operators why mention it at all?

Then under the heading "The include Statement" we find this gem: "To make sure that a file is included and to stop your program, immediately use require and its counter part [sic], require_once." Huh? To stop my program use require? Did anybody actually read this book before it hit the stores?

This is a 350 page book, and my impression is that the authors either wrote an 800 page draft before slashing random parts, or wrote a 50 page draft and threw in lots of fluff to get it up to a saleable size. I recommend you don't waste your money on this first edition... it should be easy to find other books on this topic which uphold the O'Reilly tradition of quality and value.



Media reviews
"I'm fairly impressed with the book, and wonder how much less abuse I would have gotten in email lists had I actually had this book. Don't worry, email lists aren't quite that bad, but they have their moments...Overall, a KnowProSE 8 out of 10. A good book which allows people to progress at their own rate, and to explore the things which interest them beyond the scope of the book."
-- Taran Rampersad, KnowProSE.com


"Learning PHP & MySQL by Michele E. Davis and Jon A. Phillips is targeting graphic designers, Flash developers and others who build web sites but want to know more about the programming side of things. It assumes a basic knowledge of HTML and the web in general. There’s really nothing in this book that anyone with an interest in programming and access to a computer couldn’t use to expand their skills a bit...All in all, the book is worth the $30 to someone starting out."
-- Cal Evans, Zend Developer Zone


"...anyone interested in web design or open source technology will apreciate this guide to creating popular web sites. From enhancing an old site to building a new one from scratch, the best applications for the best results are covered here."
-- Diane Donovan, California Bookwatch



Read all reviews

See larger cover


"A good book which allows people to progress at their own rate, and to explore the things which interest them beyond the scope of the book."
--Taran Rampersad, KnowProSE.com