Know any dead trees that can teach me about php and MySQL?
November 20, 2006 12:10 PM   Subscribe

Recommendations for a book to teach myself php and MySQL?

I have a basic "copy and paste" knowledge of php and even less knowledge of MySQL. I currently use online tutorials for specific problems. I'm hoping for a book that can start me off with basic php and then take me through more advanced lessons. Since I don't know much about MySQL, I'm also hoping that the book could help me with that.

Some of the things I wish I could master include XML parsing, PEAR requests and using php within Wordpress, Drupal or other CMS's (and a whole bunch of MySQL stuff).

I know there's plenty of online tutorials and full lessons, but I think that a book will be a better way to start for me.
posted by dripdripdrop to Computers & Internet (8 answers total) 12 users marked this as a favorite
 
For mysql, there is a great little game called galaxql.

As for php, I'd find a project, like some sort of serious hack onto wordpress, and try and figure out how they built it, and from there, try and bend it to your will. Only really works if you've got a serious project in mind, though.
posted by Freen at 1:06 PM on November 20, 2006 [1 favorite]


You can do worse than Larry Ullman's PHP and MySQL for Dynamic Web Sites. It's how I learned, and I do okay. The link points to the website supporting the book; you'll have to buy the book yourself. It doesn't deal with XML, and only lightly with PEAR.

(Actually, I used that and the now dated 'Programming PHP' by Lerdorf and Tatroe. These days I use the PHP website as my reference.)
posted by ardgedee at 1:20 PM on November 20, 2006


I always liked the "PHP x Bible" series. I learned from the PHP 3 Bible, and it was great because it went into the structure and didn't just provide 'practical' examples.

However, the PHP website is the gold standard in PHP documentation and is really all you should need.
posted by SpecialK at 3:26 PM on November 20, 2006


Don't limit yourself to "MySQL". If you really want to understand how relational databases work, then find a good book on generic SQL. Once you have learned the concepts, map them onto the specific dialect of MySQL. And if you do go with a MySQL book, make sure it is one that focuses on modern MySQL.

You see, until relatively recently (v4.1 and v5.0) MySQL has lacked certain features that other databases have had since day one (subqueries, unions, stored procedures, triggers, views, foreign key constraints, ...) and because of it a lot of the older extant MySQL tutorials/books would teach you a very limited subset of what SQL is supposed to be. You really do yourself a disservice if you follow this philosophy of "I need to remain compatible with MySQL 3.2 and I don't need none of that fancypants crap anyway."

Even on the most up-to-date version of MySQL, you can't use a lot of these features (transactions, foreign keys, ...) with the MyISAM2 engine, which is the default storage engine. This means that there is another added constraint of having to make sure that the InnoDB is compiled into your version and available for use, and that you select it when creating tables. (It's also a lot slower in some cases than MyISAM2, surprise surprise.)

I think I'm wandering a bit here but my point is that learning SQL with MySQL puts you, the student, in a really unfortunate position, because by design MySQL presents a lot of obstacles to doing "proper" SQL. Its design philosophy has always been to eschew things like proper transactional integrity as extraneous. This means that if you learn the type of relational database design that you get from a typical MySQL tutorial or a book that focuses on an older version of MySQL, that you really do yourself a disservice. To make a very tenuous analogy, it would be like learning to cook from a text that insisted you always start from frozen ingredients, never fresh, because they can be kept in the freezer for months without going bad and who really cares if they have a little less flavor and nutrient content, anyway.
posted by Rhomboid at 3:47 PM on November 20, 2006


Rhomboid writes "I think I'm wandering a bit here but my point is that learning SQL with MySQL puts you, the student, in a really unfortunate position, because by design MySQL presents a lot of obstacles to doing 'proper' SQL. "


What Rhomboid said. If you learn MySQL, you'll have to unlearn it to use real databases. Learn real SQL, then apply that MySQL.
posted by orthogonality at 4:39 PM on November 20, 2006


I'm really not sure what to recommend for a beginning to mid-level book, but when you're looking to move up from an intermediate level, you might try PHP 5 Objects, Patterns, and Practice. I picked it up for a quick review of PHP 5 changes and syntax, and was pleasantly surprised to find out they really did take time to talk about good practices and design patterns.

One big problem with PHP (the main one, IMHO) is that a good chunk of PHP programmers and books don't seem to care about good practices at all. Thus, a large portion of the example code floating around out there is awful. I really can't think of an introductory book I've seen that I thought was good. But maybe it's enough to learn the basics of variable and control flow and functions and objects and then look around for good practices.

There are some suggestions in this thread about beginning php. Also, I've had some acquaintances recommend the "Spring Into" books (there's probably a Spring into PHP) and O'Reilly's introductory books.
posted by weston at 5:42 PM on November 20, 2006


Also, don't forget that if you really want dead tree, you could always go get the downloadable documentation for PHP. Get the single-page HTML file, and print it out. With some page imposition tricks, it might even be cheaper than buying a book. :)
posted by weston at 6:53 PM on November 20, 2006


All of the above suggestions are good.

With regard to XML, once you've got your head around PHP5, I'd suggest reading Apress' "Pro PHP XML and Web Services" - the PHP XML libraries don't seem to be well-documented online, but this book lays them all out brilliantly and provides comprehensive examples of how to use the XML libraries - DOM, SimpleXML, XSLT, SAX, XMLReader, XML-RPC, SOAP etc.
posted by tommorris at 12:43 PM on November 21, 2006


« Older Have you read/heard of a story about an Irish man...   |   a vegan's gotta eat in manchester... Newer »
This thread is closed to new comments.