How to Do Everything with PHP and MySQL 354
How to Do Everything with PHP and MySQL | |
author | Vikram Vaswani |
pages | 381 |
publisher | McGraw-Hill/Osborne |
rating | 7 |
reviewer | Michael J. Ross |
ISBN | 0072257954 |
summary | A tutorial on PHP and MySQL, geared to the new developer. |
The publisher has a page on their Web site devoted to the book; for some reason, it lists the book as containing 400 pages, but my copy has 381. The page also has links to a table of contents and a sample chapter, namely the first one. For those readers with very slow Internet access or unstable Adobe Acrobat plug-ins installed, be aware that the sample chapter -- and even the table of contents -- are offered only as PDFs, but the two links give no warning.
Most technical publishers, for every one of their books, wisely have links to the errata and sample code, right there on each book's Web page. This is the best approach, because when readers are having difficulty getting a book's examples to work correctly, they want to be able to quickly find and download the most up-to-date sample code, as well as check the errata page for any bugs in the printed code. Unfortunately, McGraw-Hill/Osborne has their links to those two types of information in an easily-overlooked part of a menubar, using small black text on a blue background. The links are near the upper left-hand corner, and outside the content section of the Web page, where the typical reader would be seeking fruitlessly for them.
The companion Web site for the book is hosted by Vaswani's software consulting firm, Melonfire. The site has the book's table of contents (in HTML), a link to chapter 1 in PDF, a profile of the author, three full-length case studies, a feedback form, and an extensive collection of links to PHP and MySQL reference material, discussion lists, articles, and tutorials. At the end of the Introduction in the book, the author invites the reader to use that companion site for connecting with other PHP users, and sharing their thoughts on PHP and MySQL development. The site itself has no such forum, so the author probably meant the discussion lists.
The companion site also has a link to download a Zip file containing all of the sample applications from the book -- from chapters 7, 12, and 16 -- comprising nine PHP scripts, an SQL file, and a data file. The code snippets themselves do not appear to be included in the download. This shouldn't pose a difficulty for the typical reader, since few of the code snippets are long. Besides, typing them in on one's computer can help to reinforce the language syntax that one is learning, as well as decent code formatting (valuable for newbies).
The book is organized into four parts.The first of these presents the basics of PHP and MySQL, including the history and features of both technologies, as well as how to install them on Unix and Windows systems, verify the integrity of the installations, and make some critical security and configuration changes, such as changing passwords. Parts II and III cover the basics of PHP and MySQL, respectively. The fourth and final part describes how to use the two together. To that end, every chapter contains snippets of code to illustrate the ideas being described. In addition, each section is wrapped up and illustrated with a sample application. For PHP, the author shows how to build a session-based shopping cart. For MySQL, he presents a simple order-tracking system. For using PHP and MySQL together, he shows a news-publishing system.
Despite its title, the book clearly does not tell the reader how to do everything with PHP and MySQL. As the author notes in the Introduction, the book is not designed to be a complete reference for either technology, but instead intended as a tutorial for Web developers who are interested in learning how to do server-side scripting in combination with a database management system. Vaswani states that he does not assume prior knowledge of programming or database fundamentals, and that these basic concepts will be taught by example, using tutorials and realistic examples. I suspect a reader not familiar with HTML, however, could be easily baffled by the book. On the other hand, most if not all developers reading a book on PHP or MySQL are likely to already know HTML well enough to understand the output of PHP-enhanced Web pages.
One strength that this book has over many similar ones is that the author explains up front how to install PHP and MySQL, rather than relegating these topics to an appendix, or skipping them entirely. This is critical, because many programmers will find that the most challenging aspects of getting started with PHP and MySQL, are simply getting them installed and working, along with a Web server, such as Apache -- and not coding the applications themselves.
Another welcome aspect of the book is the author's enthusiasm for the technologies -- although characterizing MySQL as "quite friendly" (page 150) is a stretch. Furthermore, his explanations are clear and concise. In addition, Vaswani makes no pretense that his book has all the answers; he frequently refers the reader to URLs in the online manuals of the products, for more details. In addition, he does a nice job of illustrating the advantages of normalized database tables, and later explaining how to format query output -- an important topic omitted in many similar books.
Yet, like all books, this one is not perfect. There are a number of errors or pitfalls in the book that could confuse the reader. They range from incomplete explanations of what a user will see when running particular commands, to the sort of errata one finds in all technical books. I found over two dozen in total (there may be more). In the interests of keeping this Slashdot version of the book review close to the recommended length, I won't list all of the problems here, but will instead refer the reader to a longer version of this book review, if they are interested in those details.
Aside from its many minor flaws, I recommend this title to any programmer who wants to learn the basics of PHP and MySQL. Even though the publisher could improve their production quality, choice of binding, and Web page, the author has done a good job of clearly presenting the major points. Future editions could incorporate fixes to the errors noted in the longer version of this review, as well as better explain to the neophyte how to test/debug the code snippets. Nonetheless, the intended reader would be well served by this particular book.
Michael J. Ross is a freelance writer, computer consultant, and the editor of PristinePlanet.com's free newsletter. You can purchase How to Do Everything with PHP and MySQL from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Comparison to Other Books? (Score:5, Informative)
One size doesn't fit everything (Score:5, Informative)
1. No proper database connection pooling (and no, pconnect is not connection pooling).
2. Can't really run Apache2 in its threaded mode because a lot of php libraries are not thread safe (although php itself is).
Don't get me wrong, I *love* both php and mysql, but for highly-trafficked sites, jsp is definitely a better choice (from my own experience).
Re:Like the old saying goes (Score:2, Informative)
Re:MySQL good, PHP not so good (Score:2, Informative)
Also, you must not have explored PHP much if you don't think any large applications exist.
Really?! (Score:1, Informative)
Darn marketing double-speak, gets you every time!
One strength that this book has over many similar ones is that the author explains up front how to install PHP and MySQL
Re:Versions (Score:3, Informative)
Re:You forgot... (Score:2, Informative)
Re:both available under open-source licenses? (Score:3, Informative)
Not entirely correct (Score:3, Informative)
That being said, it is a toy database, and as such, should not be used on serious projects (i.e., anything that uses normalized data schemas and requires data integrity).
PHP editorfor Linux, anyone? (Score:3, Informative)
If anyone can point me to a good *free* PHP editor for Linux, I'd be very glad. The editors for Linux I find here http://www.php-editors.com/review/ [php-editors.com], are not good enough. I want one I can get for free.
Re:Like the old saying goes (Score:3, Informative)
php strings
and it takes me right there, and with seven fewer keystrokes than you, making me more efficient.
Re:PHP editorfor Linux, anyone? (Score:3, Informative)
Re:PHP editorfor Linux, anyone? (Score:5, Informative)
I use vim, but make sure you set ctags up.
Re:PHP editorfor Linux, anyone? (Score:1, Informative)
[OT] Re:PHP editorfor Linux, anyone? (Score:3, Informative)
Kate
Has syntax highlighting (including recoginizing builtin functions), bracket matching, code folding, regex search and replace, blah blah.
If you want one that does fancier stuff like show you class structures etc, then I dunno. Eclipse has a PHP plugin I heard - dunno how it works. One of my friends is huge into zend studio (non-free), but he works at a university (where they think nothing of spending a students tuititions worth on a computer - what do you mean our programmers don't need 23" apple cinema displays?)
Re:Is that Realistic? (Score:3, Informative)
Re:I hate the title (Score:3, Informative)
ANd why not use PHP to implement them?
It's unnecessary, that's all. A text or HTML editor with FTP, SFTP, or WebDAV can do the job just as well. And for sites that actually get traffic, it's best to minimize the amount of database hits and processing required to display a page.
Just because you *can* is not a reason why you *should*. (Now if only I'd think that way while driving...)
Re:You forgot... (Score:5, Informative)
PostgreSQL, SQL Server, Oracle, and many other database systems (including commercial and open source) have been ACID compliant for quite some time. Not to mention the abundance of features that other database systems have, like stored procedures, triggers, views, subselects, etc. Many of those features have not yet made their way into MySQL and may not until 5.1; some have been recently added to production releases; others are still in "5.0" beta.
Even then, data integrity and features have never been a primary concern of MySQL developers.
Access manages to beat MySQL; MySQL completely chokes (for whatever reason) on joins that Access handles in seconds. SQL Server, PostgreSQL handle these queries fine.
Re:No, buy a SQL book (Score:2, Informative)
I was actually giving Postgre the benefit of the doubt by lumping it in with SQL Server and DB2. I've never used it, but I've heard good things about it. I was planning on giving it a shot once a version of Toad [toadsoft.com] came out that supports it.
Re:One size doesn't fit everything (Score:3, Informative)
No proper database connection pooling (and no, pconnect is not connection pooling).
Huh? What is it, then?
Can't really run Apache2 in its threaded mode because a lot of php libraries are not thread safe (although php itself is).
Clearly only a problem if you're using those php libraries that aren't thread safe, and even then, the performance increase of threaded apache usually isn't worth the additional programming overhead of dealing with threads - and if you really need to squeeze every ounce out of your boxes that you can you're probably better off not using apache in the first place.
Don't get me wrong, I *love* both php and mysql, but for highly-trafficked sites, jsp is definitely a better choice (from my own experience).
I can't imagine a site which is so heavily trafficed that the cost of hardware saved by using jsp vs. php is worth the cost of programmers to program in it. And then, you're probably better off not using apache at all in those situations. Of course, maybe you can find some cheap jsp programmers, but in my experience php is a lot easier to code.
Re:No, buy a SQL book (Score:2, Informative)
their mysql admin tool rocks
http://www.toadsoft.com/toadmysql/toad_mysql.htm [toadsoft.com]
they also have a sqlserver version now too
http://www.toadsoft.com/toadsqlserver/toad_sqlser
If you use mysql, oracle or sqlserver you are missing out if you have not tried toad.
Re:Risk of SQL injection (Score:3, Informative)
This [owasp.org] can be useful for you.