Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror
×
PHP Books Media Programming Book Reviews

PHP and MySQL Web Development, 2nd Edition 172

honestpuck writes with the short review below of Sams' PHP and MySQL Web Development, 2nd Edition, which he says is aimed at "someone who has programmed before needs to know about both PHP and MySQL," and a good book for the intended audience. Read on for his thoughts on the book.
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.

This discussion has been archived. No new comments can be posted.

PHP and MySQL Web Development, 2nd Edition

Comments Filter:
  • by ThomasFlip ( 669988 ) on Monday May 19, 2003 @12:05PM (#5991817)
    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.
    • by Anonymous Coward
      There is more to life than man pages and other various unorganized online documentation. Some prefer to find their answer quickly.
    • by ciroknight ( 601098 ) on Monday May 19, 2003 @12:09PM (#5991850)
      not to make myself out as a loser or anything, but most online tutorials explain the how, but not the why of the problem. When I first learned about interfacing the two languages, I made hundreds of code mistakes, and I could never find out why my code didn't work. No web tutorial tackled the task of debugging bad code, none explained what SQL was to me, it just said "do this, then do that". So, before you diss the book, look into the why of having a book, then critizise.
      • by MattW ( 97290 ) <matt@ender.com> on Monday May 19, 2003 @01:14PM (#5992388) Homepage
        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'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
        • 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

    • by cvd6262 ( 180823 ) on Monday May 19, 2003 @12:21PM (#5991946)
      Have you ever tried to pull up online documentation in an airport in a third world country? Or how about on an airplane? Nothing sucks worse than being on an 11-hour flight and realizing that you don't know something that's going to halt your coding binge worse than having to change your laptop battery.

      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.
    • by Anonymous Coward
      I prefer using books because at any one time I could be working on different projects that require me to program in more 5 different programming languages and sometimes I have a hard time remembering the different syntax of functions. It is alot faster for me to find what I am looking for in a book rather then firing up a webbrowser and searching google. Also, not every programming language and program are documented on the net as well as PHP and MySQL are.
    • by the_duke_of_hazzard ( 603473 ) on Monday May 19, 2003 @12:26PM (#5992002)
      I disagree strongly. Online documentation tends to be inconsistent, poorly thought out and unclear.

      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...

      • Maybe you were checking for your online php docs at d00dzIhavePHPd0cs.org instead of php.net, because php.net has fantastic documentation. It is incredibly authoritative, and I've solved more little problems by reading user comments attached to the docs than I'd solve reading a dozen books. The comments are far more likely to be relevent, much easier to search than a bunch of books, and the php.net website is always up to date with the latest version -- even if you're using CVS php, you can often find the d
        • php.net and other online docs are only good if you know what you're looking for.

          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.
          • If you're learning PHP as a first language, I think it's safe to say you're destined for ineptness. This just has to do with the fact that PHP is too loose in what it permits, and there are so many 'wrong' solutions for every right one. If I had a friend who started programming, I'd start them on 'teach yourself C in 21 days', and then get them to read Knuth. Then, maybe, try some PHP.

            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
        • Fair enough - I didn't use that site when I had problems with php; I am sure it is very good. I think from what you say we're pretty much agreed. I mean, if someone said online docs were pointless I'd have sprung to their defence too.
    • While the PHP and MySQL annotated documentations are excelent, they show how to use the tool, not what kind of things you can do with them. The focus of the book is not php nor mysql, is web development, using those tools, doing specific widely used task also, maybe implemented with php and mysql, I agree, but it cover a lot more than simply what are those tools.

      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

    • 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

    • Yes, there's plenty of tutorials out there. A lot of them are also utter crap, especially regarding SQL. A newbie can't be expected to be able to judge what's sound advice or not.

      A book usually goes through more QA and review before they're published.
  • by joeldg ( 518249 ) on Monday May 19, 2003 @12:07PM (#5991834) Homepage
    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.
    • by Wee ( 17189 ) on Monday May 19, 2003 @12:44PM (#5992138)
      I own this book, and it's a good one (it has a lot of examples, and the chapter on generating PDFs was interesting, for example). I'd actually recommend O'Reilly's Web Database Applications with PHP & MySQL [oreilly.com], however. I think the example code is better, and it went into individual details of MySQL and PHP more. You're exactly right about one thing: once you've used either book for any length of time, they become obsolete. PHP moves pretty fast, and even small revs of MySQL can contain lots of new features. Both the PHP and MySQL web sites are excellent references which a book just cannot compete with, no matter how good it is.

      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

  • by esconsult1 ( 203878 ) * on Monday May 19, 2003 @12:10PM (#5991855) Homepage Journal
    I dont want to throw a wet blanket over all of this, but again, here's a LAMP book that perpetuates terrible PHP coding practices.

    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.

    • Do you know of any resources you can recommend that document or explain best practices?

      If not, would you be willing to post a reply with the top 2-5 things you've found important?
      • by Christianfreak ( 100697 ) on Monday May 19, 2003 @12:37PM (#5992086) Homepage Journal
        1. Checking any input from outside the program

        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.
        • I fully agree. I am working on a huge ASP project that some dumb ass wrote without knowing anything about what he was doing. Now the financial data for the last 5 years is totally inaccurate all due to bad input.
    • I'm an unemployed tech writer, with nothing better to do. I know Perl, but not PHP, and I know jack about "best practices". Send me email if you wanna collaborate.
  • PHP 5? (Score:2, Interesting)

    by seangw ( 454819 )
    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.
    • Re:PHP 5? (ummm) (Score:2, Informative)

      by joeldg ( 518249 )
      PHP is *not* ready for "production" the latest stable release is here: http://qa.php.net/ [php.net] if you are wanting to *look* at the development version then http://snaps.php.net [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 anyt
      • Actually, I'm not even ready to mark them as stable after they're officially released. PHP seems to have a lot of, "Oops! Here's a follow-up release three days later that fixes something horribly wrong with our last release."

        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.
    • I don't know if the book does, but you can take a look at this PDF:

      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)

    by b17bmbr ( 608864 ) on Monday May 19, 2003 @12:11PM (#5991871)
    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."
    • Re:backwards compat. (Score:1, Informative)

      by Anonymous Coward
      >>$_POST vs. $HTTP_POST_VARS.

      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.
    • books should also have some backwards compatibiltiy discussion. for instance: $_POST vs. $HTTP_POST_VARS.
      Yup, Luke & Laura talk about the difference between the new $_POST array and $HTTP_POST_VARS, which it replaces, as well as the use of global post variables (which are now disabled by default). They take the reasonable approach of using $HTTP_POST_VARS in their examples because it's most compatible.
  • by glwtta ( 532858 ) on Monday May 19, 2003 @12:12PM (#5991881) Homepage
    As someone aptly pointed out about seven PHP/MySQL book reviews ago: There are three things the world doesn't need more of - cars, people and "Developing webapps with PHP and MySQL" books.

    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.

    • But it was given a rating of 9! That must mean its practically perfect!

      An online Starcraft RPG? Only at [netnexus.com]
      In Soviet Russia, all your us are belong to base!
      Karma: Redundant
    • I think what we really need is a PHP/MySQL for Dummies book (or am I too late?). Then, we need the Video Professor to offer a full suite of PHP-MySQL lessons which are free if you are not fully satisfied, and we need a monthly magazine devoted to PHP/MySQL, perhaps we can call it phpMyMag, or something catchy like that. All of these wonderful resources will discuss various ways one can do such amazing things as

      1. Jump-Start your Web Development Career!!!
      2. Create Webpages which Display Data From Databases.
    • As someone aptly pointed out about seven PHP/MySQL book reviews ago: There are three things the world doesn't need more of - cars, people and "Developing webapps with PHP and MySQL" books.

      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

      • 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 done before?

        Yeah... I'd like to see 400 blank pages and the last one says "JUST USE PERL".

    • Maybe the book review itself wasn't remarkably wonderful, but I did find this very helpful link [lerdorf.com] in these comments.

      Never see PHP stories again:

      1. Login to Slashdot
      2. preferences link
      3. Homepage tab
      4. "Exclude Stories from the Homepage" section
      5. Topics subsection
      6. Scroll down and check PHP
      7. Scroll to bottom and click save button
      8. Stop complaining about PHP book reviews (some of us find them helpful)
  • by Seek_1 ( 639070 ) on Monday May 19, 2003 @12:25PM (#5991998)
    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! ;)
  • select * from tablename

    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.
    • SELECT * FROM table == bad

      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. :)
      • A. I was being sarcastic. I've been a database developer for years.

        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.
        • I think you're both deluded. ;+)

          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
          • Well, I think you're partially right... It'll do a full table scan without a where clause, but it'll do an *additional* one to get the column names/types. So doing a "Select * from tablename" would do at least two full table scans. true, adding a where with an indexed column is gonna drop one, but my point is that I'm pretty sure that the "*" automatically adds another pass. I'd have to pull up query analyzer to be sure, and I don't have that sitting in front of me right now.

            But my point is, and I still
            • Ok.. I just checked, and SQL Server at least will only do one table scan when you do a "select * from mytable". This makes sense, because the database engine doesn't need to do a table scan to find out all of the columns in the table; it just uses the metadata about the table in the database instead. In the case of SQL Server, the database engine probably looks at the contents of the sysobjects and/or syscolumns system tables to get the column information. And in that case, there shouldn't be a table sca
  • by Anonymous Coward


    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!
    • MySQL and Perl for the Web, Paul DuBois, published by New Riders. DuBois also wrote MySQL, also published by New Riders, which IMO is the best MySQL reference book around. Good stuff.
  • php.net (Score:5, Informative)

    by SPaReK ( 320677 ) on Monday May 19, 2003 @12:33PM (#5992062)
    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 [php.net] and phpbuilder.com [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.
    • Re:php.net (Score:5, Informative)

      by dJCL ( 183345 ) on Monday May 19, 2003 @12:49PM (#5992184) Homepage
      I've also found devshed.com has some userful tutorials for php and mysql, quite well done ones in fact. I have used examples from there in my production code.(Esp. the template info, saved me a lot of time and beautified my code a lot too)...
  • i18n (Score:5, Interesting)

    by Tony Laszlo, Tokyo ( 535053 ) <laszlo@Nospam.issho.org> on Monday May 19, 2003 @12:34PM (#5992068) Homepage
    Someone needs to write books that address the need to deal with multiple language, bidi and related issues. PHP and MySQL can handle [issho.org] more than most people think, but one thing holding the non-Latin-1 development back is a rather chronic case of Latin1-centricity.
  • MySQL (Score:2, Informative)

    by pchown ( 90777 )
    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 comp
    • Re:MySQL (Score:4, Informative)

      by Surak ( 18578 ) * <surak&mailblocks,com> on Monday May 19, 2003 @12:55PM (#5992225) Homepage Journal
      MySQL with InnoDB tables supports foreign key contrants and uses transactions. In fact, a site you may have heard a thing or two about [slashdot.org] uses MySQL with InnoDB tables.
    • I prefer Postgres over MySQL, but I will point out that there is a method of using things like foreign keys and transactions in MySQL - InnoDB [innodb.com]. I haven't used it yet, but if anyone is using MySQL and may be needing transaction processing or the like, they can look into this.
    • I'm posting this because I'm sure you will get a flood of posters arguing that in fact MySQL does support foreign keys and transactions with InnoDB... blah blah...

      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
      • That is all true. But the fact is that you don't always need all that stuff. The reason that MySQL is so popular is that it is simple and easy. If you need more than it can offer, use something else.
        • 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 someth
          • Thank you, yes. Bad constraints for the date types are just one example of disregard for serious data handling.

            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
  • by ubiquitin ( 28396 ) * on Monday May 19, 2003 @12:45PM (#5992152) Homepage Journal
    What will really allow PHP to compete head-on with ASP.NET and SharePoint is PEAR [php.net] 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.
  • by everyplace ( 527571 ) on Monday May 19, 2003 @12:49PM (#5992182) Homepage
    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.
  • Why PHP? (Score:2, Interesting)

    by SharpFang ( 651121 )
    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
    • Sheesh, what do you want, some weird characters like ] to open a string and [ to close it? Nobody would ever use that.
      • ', () - used in SQL. " - used in HTML. ( are always used outside the quotes, so they shouldn't be a big problem. Give up these 4 characters and there's nothing to quote. Use ` for strings, [] for brackets, there's some characters left for arrays yet... Remember F77 used ".eq." for "=" and ".gt." for ">" and it is still one of languages of choice for science.
    • Re:Why PHP? (Score:2, Informative)

      by localekko ( 587362 )
      I find using heredoc syntax when assigning strings can make things a bit more legible...

      $sql = query
      SELECT whatever FROM wherever WHERE name LIKE "%{$_POST['search']}%"
      query;

      etc.
    • Re:Why PHP? (Score:3, Informative)

      by Jetson ( 176002 )
      $a.='('.$_POST["it$f['n1'][$i]"]."='${q2}');";
      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

    • Bah.

      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.string .php [php.net]

      Notice that there are actually several methods of variable escaping and quoting available, even complex variable parsing in heredocs format.

  • by ergonal ( 609484 ) on Monday May 19, 2003 @01:22PM (#5992461)
    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.
  • MySQL is a great database and we currently use it in production for our servers. It has provided some very impressive performance results.
  • Aren't there enough PHP/MySQL books out there? More to the point, aren't there enough clueless fuckwits out there using PHP and MySQL to retardedly kludge together unsecure, inefficient, shoddy websites, undercutting the pros with their stupid prices and generally carving up the IT job market further than it already is with their general fuckwittery?

    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.

Beware of Programmers who carry screwdrivers. -- Leonard Brandwein

Working...