Slashdot Mirror


PHP and MySQL Web Development, 2nd Edition

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.

172 comments

  1. Why not Online Documentation ? by ThomasFlip · · Score: 5, Insightful

    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
    1. Re:Why not Online Documentation ? by Anonymous Coward · · Score: 3, Insightful

      There is more to life than man pages and other various unorganized online documentation. Some prefer to find their answer quickly.

    2. Re:Why not Online Documentation ? by ciroknight · · Score: 5, Insightful

      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.

      --
      "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
    3. Re:Why not Online Documentation ? by cvd6262 · · Score: 4, Insightful

      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.

      --

      I'd rather have someone respond than be modded up.

    4. Re:Why not Online Documentation ? by Anonymous Coward · · Score: 1, Insightful

      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.

    5. Re:Why not Online Documentation ? by the_duke_of_hazzard · · Score: 4, Insightful
      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...

    6. Re:Why not Online Documentation ? by slothdog · · Score: 2, Interesting

      Ok, then how about downloadable documentation?

    7. Re:Why not Online Documentation ? by gmuslera · · Score: 2, Interesting
      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.

    8. Re:Why not Online Documentation ? by Anonymous Coward · · Score: 0

      This is true for a lot of things. But the documentation for PHP is great; they explain everything well, and also let the users annotate it. Just download the documentation and put it on a CD, and you have it all with you free and searchable!

      --Jason

    9. Re:Why not Online Documentation ? by MattW · · Score: 1

      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 docs, which are marked with changes by version.

      Moreover, for quick reference, you can't beat typing in php.net/[searchterm] for an instant lookup shortcut.

      Don't go applying to php what can (and often does) apply to other languages, because you're sending people after second-best solutions that cost money when the best choice is free.

      This isn't to say a book doesn't have its place, but for php+mysql, that place is as a guide to design and development, not as a function or language reference.

    10. Re:Why not Online Documentation ? by viktor · · Score: 1

      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 need gathered in one place, written in the same style, using the same sort of examples, with the same notation and so on. Consistency is, at least for me, important for my effeciency in aquiring knowledge.

      It is simply easier for me to get all the information from someone who thinks and writes consistently throughout. Online tutorials are great, and I'm very thankful for their existence, but I therefore do not think that books should somehow be considered obsolete or a waste of money.

    11. Re:Why not Online Documentation ? by kootch · · Score: 1

      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.

    12. Re:Why not Online Documentation ? by Anonymous Coward · · Score: 0

      What's downloadable documentation but a poorly written book in a volatile format?

    13. Re:Why not Online Documentation ? by MattW · · Score: 1

      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 from the top all the way down until where the function reference begins. Then read that section again.

    14. Re:Why not Online Documentation ? by Brummund · · Score: 1

      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.

    15. Re:Why not Online Documentation ? by the_duke_of_hazzard · · Score: 1

      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.

    16. Re:Why not Online Documentation ? by denisdekat · · Score: 1

      Not just man pages I would say, there are alos php.net and mysql.com Both have plenty to learn from.

      butterflies

    17. Re:Why not Online Documentation ? by plugger · · Score: 4, Informative

      The online manuals at mysql.com and php.net are hardly disorganised. Php.net is very good, each page of the manual has user anotations where people share experiences with pitfalls and handy tips. As for finding answers quickly, I like to have an introductory book to get a feel for the language and how it works but when searching for builtin functions, a search engine can't be beat.

    18. Re:Why not Online Documentation ? by mystic_cowboy · · Score: 1

      You're absolutely right, Thomas, you don't NEED a book. There are many tutorials ranging from excellent to awful out there. Yes, PHP and MySQL have extensive documentation. And, yes, this is an excellent book. This isn't open source vs. the evil empire. Having an incremental, well structured tutorial that builds on itself can greatly speed the learning process. Text books that aren't just rehashes of man pages are very welcome on my bookshelf. Maybe you can learn a new language for breakfast. Maybe you don't mind spending the time sifting through the disjointed, out dated, uneven and unverified material on the web. I wish I were as clever.

      I depended on the 1st edition to get me up to speed. It provided me the foundation to be able to understand the documentation that came with the distributions. It save me countless hours of thrashing around looking for answers. I've had the 2nd edition for about a month now and find that it is a good update and will remain my first go-to reference. As has been stated many times it's often a tradeoff between money out of my wallet and time spent searching for answers. Both approaches have their value but this book is worth its price many times over in saved time and decent solutions. Learning the hard way may offer bragging rights. Give me a good textbook anytime.

    19. Re:Why not Online Documentation ? by kootch · · Score: 1

      destined for ineptness? All the guy wanted to do was create his own little forum from scratch.

      an in that case, PHP/mySQL was the natural choice.

      So now, just because PHP/mySQL was his first language/database, and because learning from function references where obviously too high-level for him, your suggestion would be to tell him to learn other languages first (C), then come back in 6 months and try to make his own site.

      Nice solution (frickin elitists)

    20. Re:Why not Online Documentation ? by MattW · · Score: 1

      It's easy to say 'frickin elitists', but the fact is that there's an insane amount of really awful code out there, some public, some private, and a disproportionate amount comes from people who try to 'program' simply by trying to learn HOW to do something, and never WHY. Now, if you're doing it as a hobby, do whatever you like and have fun. But it will be a lot harder to UNLEARN bad habits you start off with than it would be to simply learn better in the first place.

      If you're writing software even quasi-professionally, then you should understand something deeper than what is required for syntactically correct and functional code, because that's not enough for good code.

    21. Re:Why not Online Documentation ? by Anonymous Coward · · Score: 0

      You might not need a book, but having one sure helps. When I first started with PHP, I tried to manage with the online documentation only. Unfotunately the documentation is more like a reference manual than a tutorial and IMHO not really well suited for learning the language. After a couple of weeks I gave up and bought PHP Bible, read it through once and after that the online documentation made much more sense.

    22. Re:Why not Online Documentation ? by blacksway · · Score: 1

      Too loose... try the dreaded ASP for size, then see how 'loose' PHP feels... breath of bloody fresh air, thats what it feels like.

  2. previous version was good by joeldg · · Score: 5, Informative

    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.

    1. Re:previous version was good by cruppel · · Score: 0

      It seems sort of odd to have a book about a language which makes dynamic that which isn't already. The book can't change with the times. I've never really understood that about any sort of web programming book. For any programming language, google is a better reference tool than almost any book. I only say almost because I'm sure someone can think of a good example.

    2. Re:previous version was good by Monty67 · · Score: 1, Interesting

      Since you asked here ya go.

      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 need. Google is great if you know what you're looking for. With a book, I get the proper "terms" which then gives me the example I need.

      Maybe its me but I have books for all the languages I have played with C, Matlab, Ada, Javascript.......you get the point.

      But as far as finding stuff on the web, you are correct, but I think books are a nice jump start.

    3. Re:previous version was good by Anonymous Coward · · Score: 0

      So last night I wanted to make a tiny change to one of my little utility programs. My DSL line was down for a few hours (stupid scheduled maintenance) but I wanted to get it done before I went to bed. Just a tiny thing; I wanted to add an NSToolbar to my main window. No big deal, right? You only have to implement two functions in the window delegate to add a toolbar. Easy, huh?

      Except I couldn't remember the syntax for the two required functions! Now, fortunately I had a local copy of the Application Kit API docs; it's installed by default with the developer tools. But what if it hadn't been? What if the only source for the documentation had been on Apple's web site?

      Books are good. Online documentation is good, but books are good, too.

    4. Re:previous version was good by mattrix2k · · Score: 1

      This goes someway towards dealing with point 2 but I agree that books almost always provide a better all-round experience than google for a new skill.

    5. Re:previous version was good by cruppel · · Score: 1

      Actually I just thought of a book. Web Design in a Nutshell by O'Rielly got me started on HTML a few years back and I kept that book near me a all times until I'd memorized every single page.

  3. What I want to know is by stratjakt · · Score: 0, Flamebait

    Does it tell you how to do subselects and triggers in MySQL?

    --
    I don't need no instructions to know how to rock!!!!
    1. Re:What I want to know is by HowlinMad · · Score: 0

      yes, very good question, I would like to know the answer to this as well.

  4. Again... no best practices by esconsult1 · · Score: 4, Insightful
    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.

    1. Re:Again... no best practices by Beryllium+Sphere(tm) · · Score: 1

      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?

    2. Re:Again... no best practices by Anonymous Coward · · Score: 0

      Where then...can I buy your book? The one that points out all the finer practices and use of PHP & MySQL?

    3. Re:Again... no best practices by Christianfreak · · Score: 4, Informative

      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.

    4. Re:Again... no best practices by Anonymous Coward · · Score: 0

      Got anything substantive to contribute? Or, you know, would you prefer to keep doing drive-by critiques?

      "This book tells people to do things they shouldn't do."

      Thanks, dude. LIKE WHAT?!

    5. Re:Again... no best practices by Anonymous Coward · · Score: 0
      5. ???

      6. Profit!

    6. Re:Again... no best practices by Anonymous Coward · · Score: 0

      You live in a fake world where you think that W3C web standards actually mean a hoot. In the real world, people use IE and contour to that leaving all your cool new W3C tricks (implemented in browsers like Mozilla) totally useless and a waste of time.

      Same goes for programming methods. Not one way is right, and if you want to talk about web practices, tell me why Mozilla can't render certain webpages as good as IE? Shouldn't Mozilla be embracing what the market leader (IE) has instead of trying to base their product around a standard group that is in over its head?

    7. Re:Again... no best practices by tha_mink · · Score: 1

      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.

      --
      You'll have that sometimes...
    8. Re:Again... no best practices by pi_rules · · Score: 1
      "This book tells people to do things they shouldn't do."

      Thanks, dude. LIKE WHAT?!


      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 just wreaks of being marketed to two-bit hackers out there. Now, if the book was targed toward "PHP databased development using MySQL" that'd be another matter. Giving good, industry -STANDARD- procedures of seperating your code from your DB is the only way to really make a decent book out of the subject. If there is -ONE single line of top-level PHP code that contains -ONE- MySQL specific line of code in it -- damn that book. That is -NOT- the way to write a web application, or any application.

      I don't even have to read the book, or the review. There will be a top-level line of MySQL code in their PHP right smack dab into the presentation layer. If I'm wrong, hey, appologies to the author, but you picked a damn stupid title if you were going to actually present a real programming design/implementation book.
    9. Re:Again... no best practices by Anonymous Coward · · Score: 0

      I don't even have to read the book, or the review.

      In other words, you're just trolling.

      Thanks, but no thanks.

    10. Re:Again... no best practices by archangel77 · · Score: 1

      It's no book, but you can find the worst practices here here and here.

    11. Re:Again... no best practices by kcbrown · · Score: 1
      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.

      This is why you want to be using a real database -- one with constraints, foreign keys, etc. So that you don't rely on the frontend script to protect you from bogus data getting into the database.

      That said, doing such checking is still good practice: it enables you to issue error messages (or dialogs, or pages, etc.) which point to the specific problem. But the proper use of a real database on the backend will, sooner or later, save you from a lot of grief.

      --
      Use 'slashdot stuff' in the subject line in any email you send me if you want to get past the spam filter.
    12. Re:Again... no best practices by Christianfreak · · Score: 1

      Not really. Even MySQL isn't going to put a string into an integer field and it doesn't put more characters than allowed in a field either.

      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 :)

  5. Re:PHP is a mess - try out ZOPE by greenskyx · · Score: 0, Flamebait

    Zope may be good and if you want to use it GREAT.
    But you can easily control what sort of errors you see in your php scripts so your message is complete BS.

    Try looking for the function error_reporting at php.net if you want to control what sort of errors you see in your scripts. It's always good to turn the error reporting way up while you are testing.

  6. PHP 5? by seangw · · Score: 2, Interesting

    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.

    1. Re:PHP 5? by MattW · · Score: 1

      I don't know if the book does, but you can take a look at this PDF:

      http://ny1.php.net/introtophp5.pdf.

      It'll give you an idea about some of the things you can expect, like being about to introduce private methods.

  7. backwards compat. by b17bmbr · · Score: 4, Interesting

    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.
    1. Re:backwards compat. by Anonymous Coward · · Score: 1, Informative

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

  8. Oh dear lord not again! by glwtta · · Score: 5, Funny
    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.

    --
    sic transit gloria mundi
    1. Re:Oh dear lord not again! by cmburns69 · · Score: 0

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

      An online Starcraft RPG? Only at
      In Soviet Russia, all your us are belong to base!
      Karma: Redundant

      --
      Online Starcraft RPG? At
      Dietary fiber is like asynchronous IO-- Non-blocking!
    2. Re:Oh dear lord not again! by rycamor · · Score: 2, Funny

      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.
      3. Take User Input From HTML Forms and Store in Databases.
      4. Design and Build Web Shopping Carts Which Display Data from Databases, and Which Take user Input From HTML Forms and Store in Databases.
      5. Learn Why MySQL Really is better than Oracle (in the Advanced section)

      Eventually everyone will get the idea that of course PHP is nothing without MySQL, and the products are really just one single piece of software. Newbies the world over will shake their head in confusion when some of us mention that we use PHP with PostgreSQL, or Oracle, or without a DBMS at all!!!.

    3. Re:Oh dear lord not again! by Anonymous Coward · · Score: 0

      There is already a php mag, but it is not mysql centric. Very good stuff actually. phparch I'll see if I can get the Video Prof on the phone a little later for you.

    4. Re:Oh dear lord not again! by PCM2 · · Score: 1
      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 done before?

      --
      Breakfast served all day!
    5. Re:Oh dear lord not again! by dash2 · · Score: 2, Funny
      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".

    6. Re:Oh dear lord not again! by rycamor · · Score: 1

      Yes, I am aware of phpArch, but that is actually a good publication, not the trendy rag I expect a "phpMyMag" would quickly become ;-). (Rule of thumb here: anything which assumes PHP and MySQL will automatically be bundled together automatically loses some credibility)

    7. Re:Oh dear lord not again! by Anonymous Coward · · Score: 0
      As some many persons aptly pointed out millions of times on /., the REAL last thing the world needs is another jagoff who doesn't know how to use preferences to filter this kind of thing out.


      Some of us want to see this, so there is a reason for it, despite your claims to the contrary.

    8. Re:Oh dear lord not again! by superyooser · · Score: 1
      Maybe the book review itself wasn't remarkably wonderful, but I did find this very helpful link 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)
    9. Re:Oh dear lord not again! by honestpuck · · Score: 1

      You said :- >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. Well, as the author of the review I thought you might like to contemplate a few points :- 1/ PHP & MySQL books sell extremely well. People want them. Therefore I can only assume they want to know which ones are worth their hard earned money. 2/ The first edition of this book was extremely well received, sold well and has a complimentary review here on Slashdot. 3/ I wrote a deliberately short review for the second edition to inform Slashdot readers as to the differences between the editions and the continuing drawbacks (though minor). I'm sorry if you don't want more books on PHP & MySQL or more review of those books. I only write reviews for books that are published and I feel worth a look for some reason. I guess if my Amazon reviews stop getting votes and my reviews here stop creating a surge in visitors to my website and stop gaining a positive comment or two I might rethink my choice of volumes to review. If you'd like different books reviewed then perhaps you should write a few. It seems that timothy is always looking for reviews, out of the five or six I have written so far he has only knocked back one. Tony

  9. It's right there on page 34 by Anonymous Coward · · Score: 2, Funny

    wget http://www.ca.postgresql.org/ftpsite/pub/source/v7 .3.2/postgresql-7.3.2.tar.gz
    tar xzf postgresql-7.3.2.tar.gz
    cd postgresql-7.3.2 ./configure
    gmake
    su
    gmake install
    adduser postgres
    mkdir /usr/local/pgsql/data
    chown postgres /usr/local/pgsql/data
    su - postgres /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

    -r

    1. Re:It's right there on page 34 by Anonymous Coward · · Score: 0

      ::gigantic yawn::

      apt-get install postgresql, anyone?

  10. Re:I AM GOING TO FAIL MY LOGIC EXAM TODAY by trix_e · · Score: 4, Funny

    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.
  11. First Edition was quite good. by Seek_1 · · Score: 5, Insightful

    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! ;)

    1. Re:First Edition was quite good. by Seek_1 · · Score: 1

      err.. sorry about the paragraph breaks. (forgot to change from HTML formatted...)

  12. All you need to know about MySQL by NineNine · · Score: 1, Troll

    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.

    1. Re:All you need to know about MySQL by jdh-22 · · Score: 1

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

      --
      Every Super Villan uses Linux.
    2. Re:All you need to know about MySQL by Anonymous Coward · · Score: 0
      99% of MySQL users wouldn't know a database form a spreadsheet, and it shows.

      And you're one of them. You are a pathetic VB hack with no degree and no job in the IT industry. And we should be listening to you because...?

    3. Re:All you need to know about MySQL by NineNine · · Score: 1

      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.

    4. Re:All you need to know about MySQL by Da+VinMan · · Score: 1

      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 full table scan. Note that just because we're using an index scan instead of a table scan, we're not necessarily optimal at this point. We may still need to consider paging, index clustering, server memory, etc.

      To jdh-22's point:
      I would agree that using "select *" instead of "select cola, colb, colc.." is bad because you'll be returning too much data. If you don't actually need all the columns in the table, don't ask for them. To request unecessary columns is just a waste of resources.

      --
      Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!
    5. Re:All you need to know about MySQL by Anonymous Coward · · Score: 0

      QUOTE: I would agree that using "select *" instead of "select cola, colb, colc.." is bad because you'll be returning too much data.

      The answer's simple, just make a view on top of a join / union of all the fields you wanna return, so the user only gets the fields they should get.

      Of course, the fact that MySQL has neither views nor unions kinda slows that solution down a bit.

    6. Re:All you need to know about MySQL by Anonymous Coward · · Score: 0

      And why is that a good answer? Seems unnecessarily complicated to me... By the way, I know what views and unions are-- I've been working with Oracle and Informix for years.

    7. Re:All you need to know about MySQL by mmdurrant · · Score: 0

      For some reason I find angry nerds arguing about databases to be extremely entertaining.

      --
      I see my shadow changing, stretching up and over me...
    8. Re:All you need to know about MySQL by NineNine · · Score: 1

      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 stand by it, is that 99% of MySQL "Developers" don't know shit about data, which can make or break so many applications. I'd bet that most of 'em don't even know that with real databases, you can write complete apps that run at the command line (I have a secret love affair with SQL Plus)

    9. Re:All you need to know about MySQL by Da+VinMan · · Score: 1

      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 scan against those either because the engine will query those system tables using an indexed column (probably the name of the table itself or its object id, I'm too lazy to check right now) to get the columns in the table.

      I would agree that 99% of MySQL "developers" don't know much about databases in general; that's why they chose MySQL in the first place. Obviously, MySQL does have its place, but I don't think they know what they're missing compared to a more complete RDBMS.

      My sympathies on your love affair with SQL Plus. ;+)

      --
      Please mod this post only if you think others should/n't read this. I have enough ego^H^H^Hkarma. Thanks!
  13. What about Perl/MySQL or Perl/Postgres? by Anonymous Coward · · 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!

    1. Re:What about Perl/MySQL or Perl/Postgres? by Daniel+Dvorkin · · Score: 1

      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.

      --
      The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
    2. Re:What about Perl/MySQL or Perl/Postgres? by Anonymous Coward · · Score: 0

      I wrote the parent post. I also have MySQL by DuBois, which you call the best MySQL reference book around and Good stuff

      For a listing of data types, operators, functions, etc., I'm sure I could get a list of these from the MySQL online docs, or elsewhere. As for anything else, I fail to see what makes the book Good stuff.

      I spent over $40 for a 700 page book that has a lot of filler, and doesn't explain to me how to use MySQL. Instead, I get a generalization book, with a big fat appendix of functions. Enough to give me acid, and to push me to look at postgres.

      I'll take a look at MySQL and Perl for the Web. But it will be through a jaundiced eye.

      And I'll continue looking.

      ps, there are other posts here about inconsistent data. I'm on a mailing list where this very issue came up a few days ago for the home web site of the mail list group's site. Inconsistent data in MySQL. That's a good thing, isn't it? To have inconsistent data in a database?

    3. Re:What about Perl/MySQL or Perl/Postgres? by Daniel+Dvorkin · · Score: 1

      [blink] Well, okay; it may be that there's something about DuBois' writing style that just doesn't work for you. I didn't think of anything in the book as "filler" -- instead I found lots of step-by-step instruction on, as you say, how to use MySQL. Everything from setting up the server to tips on query construction (which is very useful; many of the limitations people complain about in MySQL disappear if you pay close attention to how your queries are built) is in there, and no, it's not stuff you'll find in the online references. The API's section is also very useful, although it would be nice if he covered Python in addition to C, Perl, and PHP.

      FWIW, MySQL and Perl for the Web is a somewhat slimmer and more compact book; it assumes you already know a fair amount about both MySQL and Perl, and doesn't take quite the "from the ground up" approach of MySQL.

      "Inconsistent data" in the context people isn't a good thing. Imagine, for the sake of argument, that you have two tables, "People" and "Employees". People has two fields named "FirstName" and "LastName". Employees has a field named "Name". Let's suppose there's a record for "Mary Smith" in Employees -- but it turns out Mary got married last year, so her record in People now has FirstName = "Mary" and LastName = "Jones"; apparently HR updated her name in People but forgot to do so in Employees. That's inconsistent data.

      MySQL lacks some of the features of other RDBMS's that are supposed to catch this sort of thing. But it can be prevented with careful table design (hint: indexing on text rather than integer fields is a bad idea, as is needless replication of data, especially text data, across tables) which is the sort of thing one learns by experience.

      --
      The correlation between ignorance of statistics and using "correlation is not causation" as an argument is close to 1.
  14. php.net by SPaReK · · Score: 5, Informative

    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.

    1. Re:php.net by dJCL · · Score: 5, Informative

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

      --
      On Arrakis: early worm gets the bird. Magister mundi sum!
  15. Re:PHP is a mess - try out ZOPE by Christianfreak · · Score: 4, Interesting

    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.

  16. Re:Perl by NineNine · · Score: 1, Informative

    Also, can one use Perl or PHP to link up to a non-SQL database such as Oracle?

    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.

  17. i18n by Tony+Laszlo,+Tokyo · · Score: 5, Interesting

    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.

  18. Re:PHP 5? (ummm) by joeldg · · Score: 2, Informative

    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.

  19. Re:PHP is a mess - try out ZOPE by Anonymous Coward · · Score: 1, Informative

    ini_set('display_errors', false);
    ini_set('log_errors', true);
    ini_set('error_log', '/path/to/my/error.log');

    SHEESH! :)

    -r

  20. Re:Perl by Anonymous Coward · · Score: 0

    You can use PHP to talk to Oracle, which is a SQL database.

  21. Re:What I want to know is--Book "worms" by Anonymous Coward · · Score: 0

    Yes I too would like to know why there are no reviews of directory services or SVG graphics books?

    And you'll note the total abscence of anything on interface managment, and very little on people managment.

    Maybe stashdot needs a small team to do nothing but book reviews. I'm certain those would be a great draw.

  22. Re:Perl by foog · · Score: 1
    The company wants me to create a dynamic site (for internal use only) to track projects and bug reports, so I've been researching dynamic Web technologies for the past several weeks.


    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 solution.
    3) doesn't want to spend money on proprietary software.

    Several weeks indeed!
  23. MySQL by pchown · · Score: 2, Informative

    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.

    1. Re:MySQL by Surak · · Score: 3, Informative

      MySQL with InnoDB tables supports foreign key contrants and uses transactions. In fact, a site you may have heard a thing or two about uses MySQL with InnoDB tables.

    2. Re:MySQL by Anonymous Coward · · Score: 0

      Are you sure that /. uses that? Need some proof, here. Us slashdotters don't just accept it when someone says something :). Somebody know for sure?

    3. Re:MySQL by Surak · · Score: 1

      Link

      Now please stop trolling me. Thank you.

    4. Re:MySQL by phong3d · · Score: 1

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

    5. Re:MySQL by Anonymous Coward · · Score: 0

      Perfect! Everyone sees your link to a relevant site and thinks you are insightful. Not everyone knows that you are a known troll. I do, though, and will expose you. Somebody else take note that the link that Surak gave says nothing about /., and yet he claims it does?

    6. Re:MySQL by rycamor · · Score: 1

      Constraints are much more than that; please see here.

    7. Re:MySQL by NecroPuppy · · Score: 1

      Somebody else take note that the link that Surak gave says nothing about /., and yet he claims it does?

      Third paragraph down, monkeyboy.

      It mentions both slashdot and Mytrix.

      YHL. HAND.

      --
      I like you, Stuart. You're not like everyone else, here, at Slashdot.
  24. One reason why online docs are better than a book by Wee · · Score: 4, Informative
    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, 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 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.

  25. what about PEAR and the PFC? by ubiquitin · · Score: 2

    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
    1. Re:what about PEAR and the PFC? by tangledweb · · Score: 1

      I do not have a copy in front of me, to tell you exactly where or how much, but the book gives some coverage to pear. Mostly by discussing the the PEAR DB abstraction class.

  26. this is a great book by everyplace · · Score: 3, Insightful

    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.

  27. Perl vs PHP question by f97tosc · · Score: 1

    This specific project aside, I have a similar question. Could somebody outline in like three bullet points what the main pros and cons are with using PHP vs Perl for dynamic web content.

    Thanks.

    Tor

    1. Re:Perl vs PHP question by frankie_guasch · · Score: 3, Informative
      mod_perl and HTML::Mason gives an impressive
      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.

    2. Re:Perl vs PHP question by Anonymous Coward · · Score: 1, Insightful

      I know I might sound like a troll,but hey,why would we drive a 2003 car when the 1990 one has 13 more years of experience!
      Dan

    3. Re:Perl vs PHP question by Qbertino · · Score: 4, Informative

      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
    4. Re:Perl vs PHP question by tha_mink · · Score: 1
      Reasons to NOT use Perl
      • It's an explosion in the punctuation factory
      • See above
      --
      You'll have that sometimes...
    5. Re:Perl vs PHP question by tangledweb · · Score: 1
      PHP Pros:
      • PHP is easier to read (particularly for a beginner)
      • If you want to learn Perl you will need to go and learn regualr expressions straightaway. They are useful if you use PHP too, but you can
      • There is more documentation aimed at the beginner and intermediate PHP user. Most Perl documentation is written with the experienced programmer in mind
      Perl Pros
      • Your code will be shorter, saving valuable finger energy when typing
      • Nobody else will be able to read or modify your code, so your job should be secure
      • You can hang out with other Perl geeks and brag that you are so superior to lesser geeks.
    6. Re:Perl vs PHP question by frankie_guasch · · Score: 1
      Some links I should have attached:

      perl.apache.org. This is the mod_perl site, nice docs, faqs, mailing lists and so.

      masonhq.com This is the mason web site. Very well documented. There are also Mason Books

      In addition mod_perl won't work well with apache2, it's still beta, so you better try with apache-1.3

  28. Re:fp! for BILL CLINTON! by Anonymous Coward · · Score: 0

    Not to mention, Bill Clinton wasn't very old in 1941 (Like Ol Ike was).

  29. Slashdot's New Business Model by Anonymous Coward · · Score: 0

    1) Post review of book
    2) Post affiliate link to book for sale on bn.com
    3) Profit

  30. Re:PHP is a mess - try out ZOPE by Anonymous Coward · · Score: 0

    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.

    you mean like this?

  31. Re:PHP is a mess - try out ZOPE by Telastyn · · Score: 2

    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.

  32. knowing the language vs knowing the ins and outs by MattW · · Score: 4, Interesting

    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.

  33. Why PHP? by SharpFang · · Score: 2, Interesting

    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
    1. Re:Why PHP? by brlewis · · Score: 1

      Sheesh, what do you want, some weird characters like ] to open a string and [ to close it? Nobody would ever use that.

    2. Re:Why PHP? by localekko · · Score: 2, Informative

      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.

    3. Re:Why PHP? by localekko · · Score: 2, Informative

      Yes that first line should be $sql = <<<query

    4. Re:Why PHP? by SharpFang · · Score: 1

      ', () - 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.

      --
      45 5F E1 04 22 CA 29 C4 93 3F 95 05 2B 79 2A B2
    5. Re:Why PHP? by Jetson · · Score: 2, Informative
      $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 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 wysiwyg editors and can structure your code so that opening and closing tags are easily identifiable and balanced.

    6. Re:Why PHP? by rycamor · · Score: 1

      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

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

  34. Secure website development by Anonymous Coward · · Score: 0
  35. Online Documentation? by ergonal · · Score: 2, Informative

    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.

  36. Re:knowing the language vs knowing the ins and out by Balthisar · · Score: 2, Informative

    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)
  37. Re:PHP 5? (ummm) by lewp · · Score: 1

    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.

    --
    Game... blouses.
  38. Another one? by jeremyds · · Score: 0, Redundant

    Apparently, five previous reviews of PHP/MySQL books isn't enough.

  39. New to slashdot, aren't you? by Anonymous Coward · · Score: 0

    A "9" is average in a slashdot book review.

  40. MySQL by blogeasy · · Score: 1

    MySQL is a great database and we currently use it in production for our servers. It has provided some very impressive performance results.

    --

    Browse the Information Directory
  41. Re:I AM GOING TO FAIL MY LOGIC EXAM TODAY by Anonymous Coward · · Score: 0

    Your logic seems to work perfectly.

  42. Re:mod parent DOWN by Anonymous Coward · · Score: 0

    This should be modded -1 [Stupidity]

    Oracle a non-SQL DB? What planet do you come from?

    Who cares what brand pc you have. It makes no difference you stupid twit.

  43. Re:MySQL -- People don't get it by rycamor · · Score: 1, Interesting

    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 database design)
    3. Domains (essentially special named datatypes that can "carry" their constraints with them)
    4. Triggers and stored procedures (so you can make the database handle other arbitrary logical needs that can't be met standard constraints and foreign keys)

    These points I mention above are not "extras". They are critical to any DBMS if you are dealing with critical information.

  44. Re:knowing the language vs knowing the ins and out by jpkunst · · Score: 1

    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 by David Sklar and Adam Trachtenberg, and the MySQL Cookbook by Paul Dubois, then. Great books, I use them all the time.

    JP

  45. YAWN by john_smith_45678 · · Score: 0

    ANOTHER review for a PHP+MySQL book?? I switched to PostgreSQL a while ago and aint looking back.

  46. Re:PHP is a mess - try out ZOPE by tha_mink · · Score: 1, Insightful

    If there are errors in your script PHP will just continue to run the script. If you are lucky you see a warning. If there is an error in a INSERT or UPDATE MySQL query it will just insert a similiar value. E.g. if you try to insert "45JF" in an integer column MySQL will insert "45" and won't give an Error.

    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.

    --
    You'll have that sometimes...
  47. code example please? by brlewis · · Score: 1

    My impression is that PHP doesn't have any significant advantage re. dynamic web content, at least not since automatically putting form inputs into variables was found to be a security hole. Got an example of code that shows off PHP's dynamic web abilities?

  48. Re:MySQL -- People don't get it by tha_mink · · Score: 1

    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.

    --
    You'll have that sometimes...
  49. Re:MySQL -- People don't get it by Sxooter · · Score: 2, Informative

    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.
  50. Re:MySQL -- People don't get it by rycamor · · Score: 1

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

    There are plenty more gotchas, such as non-standard SQL, whatnot... Too many for my comfort.

  51. Re:PHP is a mess - try out ZOPE by Anonymous Coward · · Score: 0

    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.

    hey dumb ass. i hope you have fun checking your input manually everytime. i prefer a database which enforces consistency to the alternative of reinventing the wheel. it's not the job of a script to do the checking just because the database is too stupid.

  52. It's in there! by PizzaFace · · Score: 1
    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.
  53. Hey, let's write one! by fm6 · · Score: 1

    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.

  54. Enough! by Doug+Neal · · Score: 1

    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.

    No, I'm not bitter... honest :P

  55. Re:I AM GOING TO FAIL MY LOGIC EXAM TODAY by Anonymous Coward · · Score: 0

    It actually turns out I didn't fail. I probably got a B+.

  56. Re:MySQL -- People don't get it by Lew+Payne · · Score: 1

    Perhaps if you learned to write adequate code that checked its user input, you wouldn't be so dependent on having the database do it for you.

  57. Re:MySQL -- People don't get it by brlewis · · Score: 1
    Perhaps if you learned to write adequate code that checked its user input, you wouldn't be so dependent on having the database do it for you.

    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 matter how many apps insert data.

  58. [Not a flame] Re:Enough! by X-Nc · · Score: 1

    What would you use instead of PHP/MySQL? I'm honestly interested in what people use and any technical reasons why they use them.

    --
    --
    If I actually could spell I'd have spelled it right in the first place.
    1. Re:[Not a flame] Re:Enough! by Doug+Neal · · Score: 1

      I'm not knocking the PHP/MySQL combination as such, (although I do dislike the language for a number of reasons), but my gripe is that it makes it very easy to write poorly designed and unsecure code. In fact you could almost say that the language style encourages it. This means that people don't really need much of a clue to build websites with PHP. Result: every idiot and his dog goes out and buys himself one of these books, knocks together some awful code, find that it kind of works, and suddenly fancies himself a professional web developer and starts charging people £10 an hour for his "services".

      As for alternatives, my favorite would probably be some kind of mod_perl based solution. Perl is a much nicer language than PHP and although not as easy to learn it does without some of PHP's brain damaged design principles and is a lot more powerful. There are a number of ways of coding mod_perl sites PHP-style (code inline with HTML) such as Apache::ASP, Embperl and Mason. I think IIS lets you use Perl in ASP pages too, but who cares about that? ;)

  59. PHP still not a choice for serious web development by Brother52 · · Score: 1

    PHP still has several shortcomings that make it a doubtfull choice for serious web development. Worse, there're no signs it's going to recover from them.

    I've had my share of PHP development (3+ years) and still have to do some. But since I discovered mod_perl, I avoid going with PHP whenever possible. Three main reasons:

    1. Lack of serious content delivery frameworks. With Perl you have Template Tookit (which Slashdot runs, by the way), Mason, Emberl, HTML::Template - all mature, well-documented and used by leading sites. With PHP you have maybe Smarty, which is nice, but its comparison to the above is laughtable.

    2. Poor (read: nonexistant) Apache integration. mod_perl lets you access Apache internals, write Apache modules, pre/post-process content, control resource usages and many-many more. There're LOTS of things that can give a great boost to any serious web app, but are simply impossible with PHP.

    3. PEAR vs CPAN. I don't think PEAR is ever going to catch up, because it's in the culture. Perl is Unix of the languages - it presents intellectuial challenge and encourages sharing and creativity. PHP does not. There've always been many decent apps for Windows and other non-Unix OSes, but nothing comparable to Unix open source movement. With CPAN vs. other free code repositories it's like this.

    If you've been doing web development in PHP for at least 3 years, I seriously suggest you look into what mod_perl has to offer. I truly regret I didn't went with it for some of my PHP apps I now have to maintain.

  60. Something in the water? by insomnike · · Score: 1

    Everyone (save the Ob. MySQL/PHP flames) seems to have liked the 1st Ed of this book, and is talking about ordering this edition for their co-workers/colleagues/selves.

    What am I missing? My GF was learning PHP, and she was going through the book and asking me questions when she got stuck, and during the first half (the language basics), the amount of times I had to say, 'That's a contrived example', or 'You don't do that in real code', or 'That's just an error in the book, it doesn't even parse properly', is un-funny.

    With the above parsing problem, several code examples are incorrect, and also the authors use code fragments without introducing what the variables that are introduced in them are for. These variables are presumably set outside the scope of the fragment, but to what values is not made explicit.

    Would it hurt to take a reasonable example, write all the code up-front, and disect it, so the user can see what input is being used to create what output?

    Philip Greenspun http://philip.greenspun.com - has a section on his site called 'Internet Application Workbook'. I started Helen (the aforementioned GF) reading this, and she was put off by his tone and the lack of actual depth into languages (this book will not teach you ADP/ASP/JSP/PHP, just how to write web applications), but I think everyone should be made read this.

    Perhaps Clockwork Orange style forced-reading is required.

  61. Re:MySQL -- People don't get it by rycamor · · Score: 1

    Heh... it's not me I'm worried about, pal; it's all the other developers who will have to write code to access my database (and possibly from multiple environments, not just PHP). For any project that involves more than one person, I would rather define my constraints once than audit every single code change in hope of preventing major disaster.

    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 bite. Last PHP/MySQL job I did ended up with a LOT of complex PHP code to do what a few views and stored procedures could do when I ported to a more relational system.

  62. congratulations! by Anonymous Coward · · Score: 0

    Fuck you Alex Borgida.