PHP and MySQL Web Development, 2nd Edition 172
PHP and MySQL Web Development | |
author | Luke Welling & Laura Thomson |
pages | 815 |
publisher | Sams |
rating | 9 |
reviewer | Tony Williams |
ISBN | 067232525X |
summary | New edition to for an excellent guide to PHP and MySQL |
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.
Why not Online Documentation ? (Score:5, Insightful)
Re:Why not Online Documentation ? (Score:3, Insightful)
Re:Why not Online Documentation ? (Score:1)
butterflies [photoplankton.com]
Re:Why not Online Documentation ? (Score:5, Informative)
Re:Why not Online Documentation ? (Score:5, Insightful)
knowing the language vs knowing the ins and outs (Score:5, Interesting)
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.
Re:knowing the language vs knowing the ins and out (Score:2, Informative)
Re:knowing the language vs knowing the ins and out (Score:2)
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.
Sounds like you want the PHP Cookbook [oreilly.com] by David Sklar and Adam Trachtenberg, and the MySQL Cookbook [oreilly.com] by Paul Dubois, then. Great books, I use them all the time.
JP
Re:Why not Online Documentation ? (Score:5, Insightful)
Or how about on a boardwalk in Southern California, trying to code something quick enough that the Mrs. doesn't get mad at you for interrupting the vacation?
I've been in these situations, and that's why I carry the first edition of this book. Well, I used to, when I was first getting into PHP/MySQL.
I'm not saying that online tutorials is not enough. I'm teaching a class in these technologies next semester, and I am requiring the students to use online references. There are just times that you do not have access to the web and must have some info.
Re:Why not Online Documentation ? (Score:3, Interesting)
Re:Why not Online Documentation ? (Score:1, Insightful)
Re:Why not Online Documentation ? (Score:4, Insightful)
Books tend to be clearer, better-researched and more authoritative. If you already know the technology well, you can sort out the online wheat from the chaff and get what you want rapidly. If not, you flail around a myriad of web pages looking for information that fits your needs.
This applies to my experience of PHP as well as other related experiences.
Of course there are exceptions to this, but my bookshelf grows and grows. Also, if online docs are so great, how come O'Reilly books still sell so well? They're hardly cheap...
Re:Why not Online Documentation ? (Score:2)
Re:Why not Online Documentation ? (Score:1)
I recently recommended this book to a friend who was tackling programming for the first time. I think it's fair to say he's learning pretty quickly from the book, and learning what questions to ask so that he can go and search the online docs.
Re:Why not Online Documentation ? (Score:2)
If you've programmed before, I don't think there's a better way to start than just going right to the docs and reading fro
Re:Why not Online Documentation ? (Score:2)
If you're writing software even quasi-p
Re:Why not Online Documentation ? (Score:1)
Re:Why not Online Documentation ? (Score:3, Interesting)
It teach a bit about php and mysql to be more complete and self-contained, but probably the online documentation of php and mysql would be better
Re:Why not Online Documentation ? (Score:2)
There are also hundreds, if not thousands, of poorly written PHP/MySQL systems with serious security issues ranging from Cross-Site Scripting to SQL-injection.
I would submit that the online tutorials you speak of might very well get one the technical knowhow to build systems, but a dedicated book where dos and don'ts are explained and best practices shown is a better way of making sure the system you build is reasonably secure to start with.
The advantage is that you have almost all the information you n
Re:Why not Online Documentation ? (Score:1)
A book usually goes through more QA and review before they're published.
previous version was good (Score:5, Informative)
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.
One reason why online docs are better than a book (Score:4, Informative)
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 [php.net] 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 [mysql.com] and get answers fast. (If you want to do this on your site, it's actually fairly simple. Check out lerdorf.com/tips.pdf [lerdorf.com]. Look midway through for a slide on the $PATH_INFO environment variable.)
The web sites obviate both books for all but beginners, IMO.
-B
Re:previous version was good (Score:1, Interesting)
1. I like a hard copy of certain things. Coding is one of them, minus HTML. (I think w3schools.org does an excellent job) I started doing pages in ColdFusion and used the Que Ben Forte books to get me going and keep going.
2. You can keep coding without a web connection.
3. Good reference and good examples. Sorry but I can't talk about the proper syntax issue, all I know is our pages are 4.01 strict complient. So I guess we're ok.
4. I have horrible luck finding what I nee
Again... no best practices (Score:5, Insightful)
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.
Re:Again... no best practices (Score:2)
If not, would you be willing to post a reply with the top 2-5 things you've found important?
Re:Again... no best practices (Score:5, Informative)
2. Checking input
3. Checking input!!!
4. Separation of logic from HTML design. (templating)
I don't know how many times the company I work for now has been burned because a previous programmer never checked any input to his scripts, rather just blindly inserting it into the database.
Re:Again... no best practices (Score:1)
Re:Again... no best practices (Score:2)
So to get around those little problems the programmer I'm refering to tended to just change fields to blobs so he could put in whatever he wanted! Come to think of it the problem was probably more due to laziness than incompetence
Hey, let's write one! (Score:2)
Re:Again... no best practices (Score:2)
This will be the beginning of a long running tirade in this thread agains the entire premise of such a book, simply based upon it's title and the number of things I have read like it.
Now, to address your question. Things like:
A) Building a PHP application from the ground up with MySQL and tieing the two together like cousins in Kentucky in a stack of hay. The very THOUGHT that a book would come out with such a title jus
PHP 5? (Score:2, Interesting)
Re:PHP 5? (ummm) (Score:2, Informative)
The dev versions should not be use in any sort of production environment until they have been realeased as stable, these change everyday and anyt
Re:PHP 5? (ummm) (Score:2)
That said, PHP is still a great tool in the right situations in the hands of the right people. The more books we can get that encourage the legions of newbie developers (I'm not trying to be derogatory) not to write dangerously wrong code, the better.
Re:PHP 5? (Score:2)
http://ny1.php.net/introtophp5.pdf [php.net].
It'll give you an idea about some of the things you can expect, like being about to introduce private methods.
backwards compat. (Score:5, Interesting)
Re:backwards compat. (Score:1, Informative)
Did you read the book?
They discuss this early on in the PHP section and give the pros/cons of each, and what version they are compatible with.
Another clueless post.
It's in there! (Score:2)
Oh dear lord not again! (Score:5, Funny)
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.
Re:Oh dear lord not again! (Score:1)
An online Starcraft RPG? Only at [netnexus.com]
In Soviet Russia, all your us are belong to base!
Karma: Redundant
Re:Oh dear lord not again! (Score:3, Funny)
1. Jump-Start your Web Development Career!!!
2. Create Webpages which Display Data From Databases.
Re:Oh dear lord not again! (Score:2)
Re:Oh dear lord not again! (Score:2)
Your timing is funny, because I was thinking of writing one. :-) Sort of. Seriously, there are, at least, publishers out there who think there is still a market for books on this subject.
All kidding aside, can anybody say what they would like to see in an introductory book on PHP/MySQL etc., maybe that hasn't been don
Re:Oh dear lord not again! (Score:2, Funny)
Yeah... I'd like to see 400 blank pages and the last one says "JUST USE PERL".
Re:Oh dear lord not again! (Score:2)
Never see PHP stories again:
First Edition was quite good. (Score:5, Insightful)
Re:First Edition was quite good. (Score:1)
All you need to know about MySQL (Score:1, Troll)
As usual, this books is lacking on real database information because let's face it... 99% of MySQL users wouldn't know a database form a spreadsheet, and it shows. No triggers... no subselects, still?? Hell, if you don't really need a database, then there's nothing wrong with using an OLEDB connector to a CSV file.
Re:All you need to know about MySQL (Score:1)
Do you know what exactly MySQL returns? I don't know either. Anyone else try figure out your code won't know either.
Don't forget if you update or alter your table, you could be grabbing a couple hundred bytes you don't need.
So, you obiously you need a book for help, might wanna pick up PHP and MySQL Web Development 2nd Edition.
Re:All you need to know about MySQL (Score:2)
B. You're wrong. That's not why you don't do "Select *". You don't do it because "select *" requires an extra full-table scan. Again, something that no MySQL developer that I've ever spoken to has any clue about.
Re:All you need to know about MySQL (Score:2)
NineNine:
That's not why you don't do "Select *". You don't do it because "select *" requires an extra full-table scan
I believe your statement is only correct if the select has no where clause.
So:
select * from mytable
Would cause a full table scan, unconditionally. Yup, that's bad.
However:
select * from mytable where myindexedcolumn = somevalue
Would not use a full table scan as long as myindexedcolumn is indeed indexed. But if it is not indexed, then we're back to a
Re:All you need to know about MySQL (Score:2)
But my point is, and I still
Re:All you need to know about MySQL (Score:2)
What about Perl/MySQL or Perl/Postgres? (Score:1, Interesting)
Being based on Perl/MySQL, how about a slashdot review of a book on Perl/MySQL?
For someone who has no programming experience, if you had a choice of only one book, which book would you recommend for Perl/MySQL or Perl/Postgres? I'm on an extremely tight budget, unemployed, yadda yadda...a book with examples, or that does several run-throughs of a working site setup would be appreciated.
A big tia!
Re:What about Perl/MySQL or Perl/Postgres? (Score:2)
Re:What about Perl/MySQL or Perl/Postgres? (Score:2)
php.net (Score:5, Informative)
Re:php.net (Score:5, Informative)
i18n (Score:5, Interesting)
MySQL (Score:2, Informative)
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 comp
Re:MySQL (Score:4, Informative)
Re:MySQL (Score:2)
Re:MySQL (Score:2)
Now please stop trolling me. Thank you.
Re:MySQL (Score:2)
Re:MySQL -- People don't get it (Score:2, Interesting)
Foreign Keys and transactions are only the beginning of the logic that a true DBMS should be able to handle. Still lacking from MySQL are:
1. Views (and for views to be truly useful they need to be updateable)
2. Named constraints (such as table and column-level CHECK constraints, and other expressions which can build business logic into your data
Re:MySQL -- People don't get it (Score:1)
Re:MySQL -- People don't get it (Score:3, Informative)
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 someth
Re:MySQL -- People don't get it (Score:2)
Not only does MySQL automatically do dangerous date conversions without complaint -- it shouldn't even allow a 0000-00-00 date in the first place. What year has a 0 month? What month has a 0 day? Also, note that MySQL allows _any_ month to have days numbering up to 31 -- even February. That means that in MySQL, every month has 32 days, and every year has 13 months. The constraints are left up to t
Re:MySQL -- People don't get it (Score:2)
Perhaps if I, along with everybody else who writes code to access the database, always, without fail, makes sure to validate user input. And if when new constraints get introduced we make sure to update all code that validates user input, then we'll be fine. However, one great thing about a real database is that you only have to specify constraints once, no matte
Re:MySQL -- People don't get it (Score:2)
Yes, I can see how MySQL, and a lack of constraints can work for one-person projects, but even then, when projects get more complex, those limitations can really bi
what about PEAR and the PFC? (Score:3)
Re:what about PEAR and the PFC? (Score:2)
this is a great book (Score:3, Insightful)
Why PHP? (Score:2, Interesting)
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
Re:Why PHP? (Score:2)
Re:Why PHP? (Score:1)
Re:Why PHP? (Score:2, Informative)
$sql = query
SELECT whatever FROM wherever WHERE name LIKE "%{$_POST['search']}%"
query;
etc.
Re:Why PHP? (Score:2, Informative)
Re:Why PHP? (Score:3, Informative)
Is there any good CGI language that doesn't have this kind of problems?
If you are comfortable with Perl then one way around the "stuff HTML into a variable and print it" problem is to use the MASON [masonhq.com] system. This allows you to embed Perl inside an HTML page rather than trying to print HTML from within Perl. One positive side effect of this role-reversal is that all static HTML remains literal text in the source code so that you can do page layout using wysiwy
Re:Why PHP? (Score:2)
You don't need quotes and brackets if you actually learn PHP's full string handling syntax: http://www.php.net/manual/en/language.types.strin
Notice that there are actually several methods of variable escaping and quoting available, even complex variable parsing in heredocs format.
Online Documentation? (Score:3, Informative)
MySQL (Score:1)
Enough! (Score:2)
This is one of the problems with the job market right now. Too many of the idiots who got in the business during the boom are still in. I know several of them.
Re:[Not a flame] Re:Enough! (Score:2)
Re:What I want to know is (Score:1)
It's right there on page 34 (Score:2, Funny)
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
Re:I AM GOING TO FAIL MY LOGIC EXAM TODAY (Score:5, Funny)
Re:PHP is a mess - try out ZOPE (Score:1, Insightful)
You're a dumb ass. You can set the error handling in PHP quite easily and if you're stupid enough to not check your input before you do an insert then you deserve what you get.
Re:PHP is a mess - try out ZOPE (Score:5, Interesting)
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.
Re:PHP is a mess - try out ZOPE (Score:1, Informative)
ini_set('log_errors', true);
ini_set('error_log', '/path/to/my/error.log');
SHEESH!
-r
Re:PHP is a mess - try out ZOPE (Score:2)
Re:Perl (Score:1, Informative)
Please. Get a book. Oracle was a "SQL" database as you say about 20 years before MySQL ever existed. MySQL isn't even a "real" database, in the technical meaning of the word.
Re:Perl (Score:2)
If your time has any value, buy an off-the-shelf product like Joel Spolsky's FogBUGZ. Or install Bugzilla or something.
That said, your management probably
1) wants to keep you busy and doesn't consider your time an expense (at least, not until layoff time comes around)
2) is deluded into thinking they need a full-custom sol
Perl vs PHP question (Score:2)
Thanks.
Tor
Re:Perl vs PHP question (Score:4, Informative)
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.
Re:Perl vs PHP question (Score:1, Insightful)
Dan
Re:Perl vs PHP question (Score:1)
Re:Perl vs PHP question (Score:2)
perl.apache.org [apache.org]. This is the mod_perl site, nice docs, faqs, mailing lists and so.
masonhq.com [masonhq.com] This is the mason web site. Very well documented. There are also Mason Books [masonhq.com]
In addition mod_perl won't work well with apache2, it's still beta, so you better try with apache-1.3
Re:Perl vs PHP question (Score:5, Informative)
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.
code example please? (Score:2)
Re:Perl vs PHP question (Score:2)
Perl Pros