PHP and MySQL Web Development, 2nd Edition
There is a good review of the first edition of this book here on Slashdot. For this second edition, I would add that Welling and Thomson have updated extensively and improved slightly a book that may well be the classic text on the topic.
PHP and MySQL are probably the most pervasive add-ons to Apache web servers across the web. Certainly they are both easy to acquire and common on a large range of web hosting systems, including several extremely low-cost ones. They also fit together extremely well.
This book demonstrates just how well. It starts out with a quick course in PHP (OK, 160 pages is hardly quick but it seems to move along at a good pace), follows it up with a brief look at MySQL before a short digression on E-commerce leads into building authentication and secure systems with the two tools (a marvelous place to start when you're thinking about commercial-grade web systems).
Then, after some more on PHP, the final section covers some large projects, a shopping cart, email service, mailing list manager and web forums. The final chapter in this section is new for this edition and covers XML and SOAP.
The new edition has been updated extensively. All scripts work now perfectly in PHP 4.3
I like this book a great deal. Even after a fair amount of time with the previous edition I still find it useful. It is well structured for finding what you need, well written, and has few typos. (Though there are still some, including ones in code examples -- when will authors learn to work straight off running code into the manuscript and keep godforsaken editors away from it? Brian Kernighan managed it twenty-five years ago.)
This would not be the best book if you had little programming experience, nor would it be the best book if you had a fair amount of PHP experience.
You will want to have some program design experience and preferably some experience with database design as these are given short shrift. The book also lacks examples and discussion of some of the less database intensive parts of PHP and some of the more obscure tasks you may need to perform. It covers what someone who has programmed before needs to know about both PHP and MySQL while informing on methods of using both to build practical and sturdy web applications. If that sounds like the book you want then I heartily recommend this volume to you.
You can purchase PHP and MySQL Web Development from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
You dont need a book to learn PHP and MySQL. There are plenty of tutorials out there for interfacing php and mysql in addition to all of the documentation the websites will provide. For any coders who already know a thing or two about coding, the book is a waste of money.
If the dollar is an "I owe you nothing", then the Euro is a "Who owes you nothing." - Doug Casey
The previous version was good.
I am sure we will be getting at least one copy of this for our office as some of the junior programmers use the books and we let them take them home.
me personally, I really only use php.net if I need to look up a function, but then I have been doing this for a long time and don't need to read about the how's and why's, just need the facts and what functions expect.
From my experience, seasoned php programmers usually have a browser open to php.net to look up functions and seldom have any PHP books.
again, however, for beginners this book series is good.
anime+manga together at last.. in real time.
As a member of the PHP (and Perl) faithful, when are we gonna learn that books like these give the community and open source in general a bad name?
Maybe I'm out of line in criticizing this book, maybe I'm looking for a different book, but when we have a book that covers web development best practices along with learning about PHP, Mysql and so on, then I will be the first in line to recommend and purchase it.
Newsfollow.com
Does anyone know if this book would include information in regards to PHP5? I'm looking for syntax / usage as well as the realistic ability to implement php5 in a production environment.
one of the problems with books like this is their lack of backwards compatibility. i used to have a safari subscription, and had this book for a while. 1st edition was very good. however, many hosting services still use 4.0.X. and for those places, that operate on thin margins, they see no reason to upgrade. it's not a cost issue, but an adminissue. i can't say that i blame them. so, books should also have some backwards compatibiltiy discussion. for instance: $_POST vs. $HTTP_POST_VARS. this will screw up lots of people. you will develop your site locally, mirror it, and then, "holy crap", it doesn't work."
My problem? I was perfectly gruntled, until some numbnuts came by and dissed me.
I know nothing will stem the tide of these, for all intents and purposes, xeroxed books, but I can at least implore (nay, beg) the people here to please, please stop sending in inept reviews/advertisements for them. There is just no damn reason for it.
sic transit gloria mundi
wget http://www.ca.postgresql.org/ftpsite/pub/source/v7 .3.2/postgresql-7.3.2.tar.gz ./configure /usr/local/pgsql/data /usr/local/pgsql/data /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data /usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 & /usr/local/pgsql/bin/createdb test /usr/local/pgsql/bin/psql test
tar xzf postgresql-7.3.2.tar.gz
cd postgresql-7.3.2
gmake
su
gmake install
adduser postgres
mkdir
chown postgres
su - postgres
-r
as evidenced by the fact that you are reading Slashdot instead of studying.
No man is an island, but Gary is a city in Indiana.
I picked up the first edition, not because I really needed to learn PHP (I was already comfortable with it), but so that I'd have something I could use as a reference. I have to say that I was EXTREMELY IMPRESSED with the first edition. It is actually my favorite programming book (out of maybe 30 that I've bought for school and fun). I like how the book progresses quickly through each chapter. And not quickly as in skipping over the details (like some other books out there), but in that they only present the info that you need, and encourage you to look up things in the online documentation for more detail. I also really liked the projects that they went through at the end of the book. It's nice to see practical applications for all of the things that the book went through. ... and for everyone who says it's only PHP and you can just use the online docs, well, I don't know about you, but I'm not exactly going to break out my laptop to do some reading on a city bus! ;)
While I haven't read this book or the previous edition. If you are wanting to learn the language and don't want to pay for the book, php.net and phpbuilder.com are two of the best sites available. They post have good references and PHPbuilder has a very useful forum in case you get stuck.
While I agree that the parent is wrong, PHP's error handling is still horrid because (at least by default) it outputs to the user of the page which could expose information to a hacker/cracker type person. I much prefer errors being logged where they can be later examined and the language should emit a 500 error to the client.
And before someone says "I don't like the crappy page that gets sent on a 500 error", with Apache you can change that error to whatever page you want.
The Anti-Blog
Someone needs to write books that address the need to deal with multiple language, bidi and related issues. PHP and MySQL can handle more than most people think, but one thing holding the non-Latin-1 development back is a rather chronic case of Latin1-centricity.
PHP is *not* ready for "production" the latest stable release is here: http://qa.php.net/ if you are wanting to *look* at the development version then http://snaps.php.net specifically states that they are "DEV" versions, and from personal experience these are unstable and not all functions are fully supported (i.e. try compiling in IMAP support and you will see)
The dev versions should not be use in any sort of production environment until they have been realeased as stable, these change everyday and anything you code with it one day, might be broken tomorrow.
I am speaking from experience here.
anime+manga together at last.. in real time.
If you're just starting in web development, don't use MySQL unless you have absolutely no choice. It will hurt you in long term.
When you first start out, you're happy that you can put data in and pull it back out. Then you find that your data gets inconsistent for some reason. To stop this happening, database designers put constraints on the data, and use transactions. If the job is done properly, it shouldn't be possible to insert inconsistent data, like a company address that doesn't belong to a company.
Unfortunately, if you chose to use MySQL at the beginning, you're now stuffed because it doesn't provide these features. What's worse, its SQL is rather non-standard, so you're going to have a problem moving to anything else. I know that people will think I'm trolling for Postgres, but I'm not really. Use any database that supports this type of feature. There are two other open source databases which are worth a look: Firebird and SAP DB.
An interesting side note: the MySQL people "stole" (Rasmus Lerdorf's words, not mine) php.net's webmaster. For a long time now, I've gotten very used to typing things like php.net/mysql_pconnect in the location bar of my browser and getting redirected to the right page in the online docs. MySQL's new webmaster brought that feature with him, so you can do things like mysql.com/select and get answers fast. (If you want to do this on your site, it's actually fairly simple. Check out lerdorf.com/tips.pdf. Look midway through for a slide on the $PATH_INFO environment variable.)
The web sites obviate both books for all but beginners, IMO.
-B
Ash and Hickory, straight-grained and true, make excellent bludgeons, dandy for the cudgeling of vegetarians.
What will really allow PHP to compete head-on with ASP.NET and SharePoint is PEAR and the PEAR Foundation Classes (PFC). A really good set of classes for web development means low-cost, robust web apps are on the way. You java gurus can eat your hearts out. The reviewer doesn't say if the book covers either of these topics, so hold off on your purchase until this becomes clear.
http://tinyurl.com/4ny52
While I have been using php.net's examples and documentation, along with the available mysql information, when I bought the first edition of this book it opened up a whole new level of work for me. I mean, yeah, you can teach yourself php and mysql without any real trouble if you have a good head. But if you have never actually used a web programming language or proper database, then where do you learn the proper ways of doing something? There's only so much examples of code can teach you; they don't necessarily teach you concepts. That's what this book did for me.
And just for reference, you can do the same thing in IIS and the such as well for all of those PHP devs stuck there.
I don't think I own a single PHP book. What I do for a living right now is code PHP+Mysql (specifically, e-commerce engine customization).
I never had a problem with stuff not working, but I did do a lot of things in ways that could have been done better. For example, not realizing at first that you could declare php functions with optional arguments (ie, function foo($x, $y=1) {}) cost me a lot of headache I didn't need. Puzzling my way through the behavior of php classes took some time, as these aren't particularly well documented (particularly variable scope in classes and methods, and the interaction between session tracking and classes).
In other words, I could have used a good 'tips and tricks' sort of book. Not basic syntax, but the sort of things you'd miss even if you got fairly far using the online docs.
The good and bad thing about PHP+Mysql is that it is a very powerful and flexible platform to develop on. But because it is SO flexible, it lets you make a LOT of mistakes. There's a big difference between a functional app, and a GOOD app.
I really wonder, why is PHP a language of choice for interacting with databases and writing HTML. I mean, it's not a bad language by itself, a bit like Perl, maybe slightly clearer (though personally I prefer Perl), maybe not as easy in common use... But it has one TERRIBLE drawback:
) ;";
Quotes and brackets.
Nothing evil by themselves, they are unfortunately just the same kind as used in HTML and SQL, which makes creating SQL queries on the fly, printing HTML piece by piece and a lot of similar work worst mess I've ever seen. I've been successful at creating Perl regexp patterns that needs a minute to be understood, but I've never before been tempted to try to optimise fragments of my program to anything like:
$a.='('.$_POST["it$f['n1'][$i]"]."='${q2}'
Is there any good CGI language that doesn't have this kind of problems?
45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
framework to work with. It's not easy to install
but you'll get a nice backend por code embedding.
Reasons to choose perl:
Separation of presentation from code: perl objects and modules.
Zillions of perl modules in search.cpan.org
Perl is a more mature language with years of existence before php. It has many more features like quite better regexpes and many more.
I'm sure the book is great, but what I like about PHP and MySQL (PHP mainly) are the user comments underneath each page. Sometimes the tips and tricks in these comments are life-saving. You just can't get that sort of value out of one book.
I'll agree. Books are good. I DON'T have a PHP nor mySQL reference, and I'm kludging my way through some PostNuke stuff. Luckily as an experienced programmer, a language is a language and it's not been a major problem. BUT, I'm not doing a serious PHP project starting from the ground up (big difference between starting from scratch and modifying someone else's work). I think if I were going to write something entirely from scratch, I'd easily spend a week working with a paper book and following along until I was comfortable not having to cross-reference everything. In fact, I tried NOT purchasing books to learn Cocoa. In this case, "a language is a language" (Objective-C[++]) more or less applied, but the class libraries ("Cocoa") demanded something a lot more structured than sporadic online documentation. I ended up buy TWO books for Cocoa. It was worth every penny.
--Jim (me)
Perl is executable line-noise.
That kinda sums it up. If you have no problem with the somewhat bizar syntax of Perl you're in. Perl is powerfull and present on allmost anything that runs even the faintest resemblence of Posix. It' ancient and so are it's homegrown semantics. If you know Unix well, take Perl. You'll feel right at home. You'll have to add AxKit, Petal (the Perl rippoff of Zope's TAL) or some other stuff to make it practically usable for larger webstuff and it will probably be slower than PHP, but therefore it's a very universal PL.
PHP on the other hand is the worlds prime dynamic web content language because it's built for, would've you guessed?: dynamic web content.
It's a subset of the large families of SSI-technologies (server-side include) like ASP (don't!), JSP (ok if you're running java), ColdFusion (don't!) and the likes. It's fast, has a bazillion readymade free products ready and beats the living crap out of Perl when it comes to developing dynamic web content. PHP projects make up the lions share of anything serious on the web. You don't need to set up Petal or AxKit/XML or whatnot to get a descent template-engine (as you'd have to with perl) but therefor it gets unpratical when you want to use it for something else then dynamic web stuff. Allthough there's a PHP-GTK lib available that let's you make 'real' apps too.
If you're mainly into dynamic web stuff take PHP. If you emphasise on Unix/Linux admining and scripting take Perl.
And take a look at Python and Zope beforehand - those are *my* favourites.
We suffer more in our imagination than in reality. - Seneca
The reason MySQL is easy is that it never complains when you do something stupid, it just does it.
Convert a column type filled with dates from text to date / time type, and MySQL will put 0000-00-00 for each date it can't figure out.
If it can't figure out any dates, they all get set to that.
Since even innodb tables can survive such a change, all your original dates are gone.
On the other hand, in a real database, you'd get errors, complaints, all kinds of guff from the database as it refused to do something that stupid.
That is only one of dozens of examples of MySQL doing things "wrong" from the point of view of reliable, coherent data, and not bothering to tell you.
If I use interbase or pgsql and don't need the features, I just don't use them. But when I need the extra features of a real database, I don't have to switch from MySQL to another database if I already started with one.
--- It is not the things we do which we regret the most, but the things which we don't do.