Slashdot Mirror


Beginning PHP and MySQL

norburym writes "W. Jason Gilmore and Apress have put together an impressive volume, both in girth and content, in Beginning PHP 5 and MySQL, From Novice to Professional. At first glance, it appears that any technical manual that tries to approach such heady stuff such as PHP and MySQL for an audience ranging the span from beginner to the uber-geek is headed for failure. Happily, I can report that Gilmore and Apress have given the world one book that will replace many other PHP and MySQL volumes. This is one that the reader will consistently rely on and keep near to hand." Read on for the rest of Norbury-Glaser's review. Beginning PHP and MySQL: From Novice to Professional author W. Jason Gilmore pages 800 publisher Apress rating 9 reviewer Mary Norbury-Glaser ISBN 1893115518 summary PHP and MySQL

One key to the book's success is the manner in which Gilmore approaches his subjects. The text is split neatly into three sections: the first deals exclusively with PHP and comprises the bulk of the book's content, the second section goes into depth with MySQL and the final chapters deal with PHP/MySQL integration. This layout is where the promise of appealing to such a wide range of user abilities succeeds admirably. The beginner can read cover to cover and come out of the pipe with a solid, practical knowledge of PHP, MySQL and how to combine the two to build advanced web applications. An experienced MySQL or PHP guru can skip the area of his expertise and gain much from the chapters on the other. A more advanced user can use this book as reference material, skim the chapter outline, pick and choose topics of interest and quickly find the answers they seek. Everything is cleanly written, with little or no anecdotal filler or asides. Each chapter begins with a nice overview of what will be covered and ends with a brief but concise summary.

Gilmore begins with nine chapters specific to the PHP language and its many core features and extensions, taking particular care over installation and configuration issues (platform specific instructions are included for UNIX/Linux (Mac OS X users can swim in this pool very easily) and Windows), basics (data types, variables), functions, arrays, PHP's object-oriented functionality and expressions. The next ten chapters delve deeper into PHP's file and operating system functions, web form integration, http authentication, file upload management, LDAP, session management (one of the best aspects of PHP and incredibly easy to use), Web Services (SOAP, SimpleXML extensions as well as NuSOAP and MagpieRSS -- cool stuff!), security and PHP's SQLite database extension. SQLite is an exciting multi-platform database engine that will most likely prove to be hugely popular in the near future. It's interesting to note that Apple plans to integrate SQLite into their next release of OS X, Tiger. Also of note is Gilmore's well-written chapter on PHP and LDAP. He provides an extremely competent introduction to LDAP and PHP's LDAP extension. If you work in an enterprise environment, this knowledge will become an integral part of your mindset and vocabulary.

The SQL section of the book is compact and concise. Gilmore manages to take the reader through a fast but detailed introduction to MySQL. Installation and configuration, clients (the standard set and some GUI based administration clients), table structures and security/user management are all explained with precision and an eye toward practical expectations.

Chapters 26 through 30 stand out, with an integrated approach to both PHP and SQL. This is where Gilmore pulls it all together. The reader is introduced to PHP's MySQL functionality, creating MySQL database classes, indexing and searching, transactions and importing and exporting data. There are numerous excellent real-world examples throughout this section that will enable the reader to create elegant, advanced web applications.

Gilmore removes the complexity and ambiguity inherent in many technical books and gives the reader a detailed approach to these two wildly popular open source packages. Beginning PHP 5 and MySQL will definitely serve the novice, the professional and those in between. For anyone wondering what all the fuss is about with PHP or MySQL or for anyone who has wanted that one volume that will explain it all, this is definitely the book for you. It is at once an excellent tutorial and an indispensable reference manual.

You can purchase Beginning PHP and MySQL: From Novice to Professional from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

20 of 228 comments (clear)

  1. I used to swear by MySQL by suso · · Score: 3, Insightful

    but now I'm using Postgres and am lovin it. It's one of those things when you didn't know what the hell you were doing before you knew about it.

    Postgres is where it is at.

  2. Re:Why MySQL? by arevos · · Score: 4, Insightful

    My guess is that more hosting firms offer MySQL than PostgreSQL. If I'm correct, then it would make sense for them to appeal to the wider audience.

  3. Re:Why MySQL? by Anonymous Coward · · Score: 1, Insightful

    Hell, I'd gladly accept a slight performance cut for the many benefits PG has over MySQL. To new MySQL users: You'll be kicking yourself later on after realizing MySQL didn't deliver the power you needed.

  4. Re:Switch from asp - php(5) by yohan1701 · · Score: 5, Insightful

    If you are unfamilar with linux and only want to learn php just install mysql and php on a windows box.

    The setup is pretty easy getting php send email is the most difficult part.
  5. Why MySQL? create user foo createdb; by temojen · · Score: 4, Insightful

    Creating a postgresql user who has the ability to create databases makes that user a superuser of ALL databases. This makes postgresql tricky to use in a mass virtual hosting environment.

    Also, most web applications are not written to take advantage of features such as stored procedures. This is probably partly because the developers don't understand them, and partly because MySQL is so common already.

    1. Re:Why MySQL? create user foo createdb; by tzanger · · Score: 2, Insightful

      Why on earth would a vhost user ever need to create databases? You create their db when you create their account, give them control over their db and they can create as many tables as their little heart desires.

      Hell with namespaces it can appear like they have completely separate databases if they really need that illusion.

    2. Re:Why MySQL? create user foo createdb; by discord5 · · Score: 5, Insightful
      Creating a postgresql user who has the ability to create databases makes that user a superuser of ALL databases.

      Not jumping to the defense of postgresql or anything (although I do have to use it quite frequently), by why would want to give a user permission to create a database anyway? Most hosting companies will provide you with one database, and that's it. If you need another one, you pay extra.

      Also, most web applications are not written to take advantage of features such as stored procedures.

      So instead of stuffing their database logic where it belongs they write complicated "sql libraries" that are a pain in the behind, riddled with bugs, and eventually just make your code more complicated.

      I've been involved in a couple of projects where I had to maintain other peoples code, and I've seen bad code, really bad code, and really really bad code when it comes to databases. One project involved a database that was supposed to keep track of visa clearing, and for each step that happened in the clearing process (there were 3 if I remember correctly) a log had to be kept in the database. The original developer had a good table design but the library that did all the logging sucked bad. Somewhere he forgot to mark a 'status' field as false and in certain conditions the shit really hit the fan (read: some customers got billed twice, or too much).

      If he had taken the time to write either stored procedures for that table (over the course of the 3 years I ran that project, the table itself never needed to be altered) his code wouldn't have been such a mess, and the modifications to that project wouldn't have taken so long.

      This is probably partly because the developers don't understand them, and partly because MySQL is so common already.

      Let's not forget the most important factor in webdevelopment projects: cost. Customers want results, and they want them fast and cheap. Having to explain to a customer that you need to design a solid database before you can write a letter of code alone is more than enough excuse for that customer to go to another developer who claims he doesn't spend that much time on his database.

      Even worse, to most customers application development couldn't possibly be more complicated than Visual Basic. Webprogramming can hardly be any more difficult than drawing boxes on your screen and the program you draw those boxes in does most of the work. Explaining to people with that attitude that a solid database design will save them possible problems in the future is like banging your head against a brick wall. The wall doesn't understand what you're trying to do, and you're left with a headache at the end of the day.

  6. Re:Books? by Nos. · · Score: 3, Insightful

    Honestly? Because I can read a book in the john. I have an old Unix Power Tools book in the basement bathroom, and I'm still learning new command line tricks. I have to admit though, I've skipped the chapter on Emacs.

  7. Re:Books? by Saeed+al-Sahaf · · Score: 3, Insightful

    I tend to go for books for two reasons. First, I'm not tied to my computer, sometimes I go out, ride a bus / train / plane, and like to read a nice fat tech book. Second, I like to have the book open WHILE I'm working on a project, and I don't have two monitors side by side. Oh, and I think I'm able to access the info faster. That's three.

    --
    "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
  8. Re:Books? by Kralizec · · Score: 2, Insightful
    I love the Internet for teaching myself something new, there are a few reasons I'm still glad books are around, though:

    1) Sometimes online resources that give a comprehensive overview are hard to come by. The web usually offers more reference-oriented materials

    2) I live in the boonies, and don't have broadband. Searching for information on the Internet is a slow and painful process when you're dealing with 28.8kbps connections.

    3) Sometimes I just get sick of looking at the computer screen.

  9. Re:register_globals = off by jdhutchins · · Score: 2, Insightful

    It will prevent those kinds of attacks at the expense of not teaching you how to write around them. It's really very easy to avoid sql injection attacks. magic_quote_gpc also has this "magic" thing, and you don't always want your data escaped. Sometimes, you do happen to do things other than database work with form data.

  10. Not sure why... by downward+dog · · Score: 3, Insightful

    To an extent, maybe, but it doesn't take that long to become "fluent" enough in PHP to do database work. PHP 5 has pretty nice MySQL and PostgreSQL connection functions that make working with databases relatively simple.

    Learning MySQL and PHP together is actually a great way to go, IMHO. Especially if you have some basic knowledge of C-syntax (C, Java, Javascript, Perl) and database concepts (basic SQL). Each program is only marginally useful without the other, and each can be learned quickly.

  11. Re:Poor choice of scope? by DrMorris · · Score: 2, Insightful

    Strange. The chapter about installing the software is the one I always skip. With todays ["user friendly"] installing routines [for popular software] these advices seem to be obsolete for me. Additionaly, if you are installing from the sources, you probably have to read some up-to-date instructions anyhow. So I don't see any reason to print OS-specific, release-dependent details in a book about a software product [for developers].

  12. Re:Books? by kfg · · Score: 5, Insightful

    . . .it seems so much easier to me to find what I'm looking for on the web.

    What you are looking for is not always what you need to know.

    KFG

  13. Re:Books? by Anonymous+Luddite · · Score: 2, Insightful


    To read enough about any subject to know it in depth, I'll take a book thanks. A lot of days I'm 12 hours in front of the monitors. After a while the screens start to bug my eyes - I find myself printing a lot of stuff just so I can sit back from the desk and read it off a page...

  14. Re:Books? by kanotspell · · Score: 2, Insightful

    disagree...
    I find the web great for getting started on a project and for getting to a more advanced level, but it's that middle ground that a book shines. Most how-to or informational sites just don't have the helpful fluff that a book carries, sure you can assemble the same amount of info from various web sources but a book is just easier.

    Plus there's just something wierd about sitting on the can with a laptop.

  15. Re:other training materials here... by Anonymous Coward · · Score: 2, Insightful

    only on slashdot could these assholes complain about the format and font sizes of free documents. get a life guys and produce something yourselves instead of ripping on someone who offered up his creation for free.

    thanks to ubiquitin for the free docs.

  16. Re:Why? Dear lord, why? by ScytheBlade1 · · Score: 2, Insightful

    More importantley: how about we get a DECENT beginners book? Correction, how about we just drop all beginners books completly?

    This is going to be modded troll, I can just feel it - but I stand firmly behind that. I do a *lot* of PHP development - and I can't count the times that I see this "cool script" out there that does this "awesome thing". Then, I take a look at it, the entire thing is a hack job, and it's labeled "Joe's First Script".

    We don't need beginners books, we need more experienced PHP devs in the first place, and a beginner's book is only going to maul the already horrible ratio of those "know PHP", and those who can actually use it, correctly.

    (That quite obviously came off strong, but I am sick and tired of people who have made money doing PHP, coming to me and asking me why they've got a parse error on line 15, yet line 15 consists of "print('hihi.');" )

  17. Re:Why? Dear lord, why? by glwtta · · Score: 2, Insightful
    the already horrible ratio of those "know PHP", and those who can actually use it, correctly.

    I'd guess that this ratio is further hampered by the tendency of people who can "use it correctly" to move on to, well, real programming languages.

    For whatever reason, PHP just tends to not be as sexy anymore once you know what you are doing.

    --
    sic transit gloria mundi
  18. Re:other training materials here... by shelterit · · Score: 2, Insightful

    Uh, this article on "problems" I found rather "looking for trouble"ish. You can create crap code examples in any language. If the article is meant to keep beginners from learning PHP, they fail because PHP is easy tp pick up for simple stuff. If it is to warn against it in professional / enterprise environments, they fail, because professionals don't do a lot of the stupid things the examples show. However, people going from newbie to cluie might bump into some of these problems, but for heavens sake; mention me one language that hasn't got similar problems! For the record, I use both Java and PHP for enterprise applications, and the golden rule is; use the language that best fits the job. I'm using PHP more and more, after being professional with Java for over 4 years, and I can write an article twice as long on the perils of Java. Look at good PHP code, both functional and OO; it can be very effective and scalable.

    --
    -- Home, James - it doesn't matter where that thing has b