Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Web Database Applications with PHP & MySQL

michael posted more than 12 years ago | from the many-little-cubbyholes dept.

PHP 275

Brian Donovan contributes this review of Web Database Applications with PHP & MySQL, the most recent of several books geared toward helping people use the common Linux, Apache, MySQL and PHP combination to produce database-backed websites. Read on for the review.

PHP's speed of execution, gentle learning curve, and ease of development have contributed to its popularity, especially when teamed with MySQL, as a tool for building dynamic sites. Williams and Lane have written a thorough step-by-step guide to building web database applications with PHP and MySQL.

The Meat of the Book

Part I (Chpts 1-3) of Web Database Applications with PHP & MySQL (Web DB Apps) introduces the "Hugh and Dave's Online Wines" case study that's used to highlight the points made throughout the text and treats readers to the fundamentals of PHP, MySQL, and SQL - appropriate since the book assumes only some prior programming experience (not necessarily in PHP) and a general familiarity with HTML.

Chapters 4-9 (Part II) deal with the aspects of web application logic common to practically all data-driven sites : querying and writing to databases, maintaining state, and security. Chapter 4, "Querying Web Databases", includes a good explanation (Ex. 4-1) of the mechanics of connecting to and querying a MySQL db via PHP - numbered blocks of the example script correspond to sections in the accompanying text detailing what's happening at each point in the process (connect, query, retrieve results, process results, and close connection- unless you're using persistent db connections).

Chapter 5, "User-Driven Querying", explains how to pass data to PHP scripts using HTTP GET and POST. Although readers are initially shown parameters and parameter values being passed directly (as they are when register_globals is turned on in php.ini), the authors later explain why the same param:value pairs should instead be accessed through the global associative arrays $HTTP_GET_VARS and $HTTP_POST_VARS (the book was completed before the switch to $_GET and $_POST respectively with PHP 4.2.0) for security reasons. What the authors refer to as "combined scripts" (where the same script performs different functions depending on which, if any, variables in the GET or POST arrays, have been set, for example) are introduced and the reader is walked through the oft-used "next and previous links for query results" scenario.

In Chapter 6, "Writing to Web Databases", in addition to inserts, updates, and deletes, the authors explain one solution to the reload problem - i.e. where reloading a results page after some operation that alters the contents of the database has been performed (or even accessing a bookmarked url if HTTP GET was used to initiate the action) can potentially result in the operation being silently repeated or, if HTTP POST was used, the user being confronted with a big ugly "would you like to repost the data?" dialog. Locking (mostly how to make the best use of table-level locking) is also discussed in all of its glory. Chapter 7 deals with the validation of user input. The authors recommend and give an example implementation of dual server and client side validation (with JavaScript). Chapter 8 covers sessions (with and without cookies).

The chapter on security (Chapter 9, "Authentication and Security") mostly concerns user authentication. HTTP Authentication, managed HTTP Authentication (using PHP to validate encoded credentials from the HTTP Authorized header field), and handling your own authentication are considered, along with the security concerns inherent in stateful web apps - i.e., third party sites maliciously tricking browsers into coughing up cookies with login or session information for your site, session hijacking by feeding random session ids to the scripts until one corresponds to an existing session, etc. SSL is explained briefly.

The third and final section of Web DB Apps (Chpts 10-13) consists of a detailed examination of the guts of the wine store case study. Readers who find the commingling of application logic and html in the snippets of the wine store application discussed in the book distasteful will be gratified to know that, since publication, the authors have released a modified version of the "Hugh and Dave's Online Wines" code that uses the Xtemplate class (http://sourceforge.net/projects/xtpl/) to separate code from markup. Both versions are available in their entirety for download from the book website.

The five appendices, in turn, cover the installation and configuration of PHP, MySQL, and Apache on a Linux system, the architecture and workings of the Internet and Web, designing relational databases using entity-relationship modeling, how to define your own session handler prototypes and store session data in a database instead of files (the default), and provide an annotated list of PHP and MySQL resources (books, web sites, etc.).

The Good and the Bad

While it's clear that Web Database Applications with PHP & MySQL was written with the goal in mind of providing novice coders with a solid foundation for continued growth (or filling the niche of "handy reference" on the shelf of intermediate/advanced developers), the book manages to be comprehensive without patronizing the reader. I admit that I wouldn't have felt cheated if the authors had skipped the obligatory coverage of the history of the Internet, TCP/IP, and HTTP (Appendix B) in favor of, for instance, a discussion of web caching with an eye towards building cache-friendly apps, an important subject that all too gets short shrift from authors of web dev books. Also, some readers may be disappointed to find that the chapter on security doesn't relate to battening down your site against script kiddies and exploits, but that's really the sort of information that you should be getting from sites like PHP Advisory and Securiteam anyway.

For seasoned developers, this could be the book that you wish you'd had when you started out building web database apps and data-driven sites. Keeping a copy around for reference, especially if you frequently jump back and forth between projects in different languages/environments, also might be helpful - for those occasions when you need of a quick refresher in PHP/MySQL dev. Moreover, if you find yourself in the position of having to mentor junior developers (or helping non-coder friends) tasked with building or maintaining PHP/MySQL-based sites or apps, then lending them your copy or recommending that they buy their own could save you quite a bit of time and frustration.

Table of Contents
  • Preface
  • Part I
    • Chapter 1. Database Applications and the Web
    • Chapter 2. PHP
    • Chapter 3. MySQL and SQL
  • Part II
    • Chapter 4. Querying Web Databases
    • Chapter 5. User-Driven Querying
    • Chapter 6. Writing to Web Databases
    • Chapter 7. Validation on the Server and Client
    • Chapter 8. Sessions
    • Chapter 9. Authentication and Security
  • Part III
    • Chapter 10. Winestore Customer Management
    • Chapter 11. The Winestore Shopping Cart
    • Chapter 12. Ordering and Shipping at the Winestore
    • Chapter 13. Related Topics
  • Appendix A. Installation Guide
  • Appendix B. Internet and Web Protocols
  • Appendix C. Modeling and Designing Relational Databases
  • Appendix D. Managing Sessions in the Database Tier
  • Appendix E. Resources
  • Index

You can purchase Web Database Applications with PHP & MySQL from bn.com. Slashdot welcomes readers' book reviews -- to submit yours, read the book review guidelines, then hit the submission page.

Sorry! There are no comments related to the filter you selected.

don't need a book (2, Interesting)

matt4077 (581118) | more than 12 years ago | (#3695163)

the online documentation at php.net and mysql.com is excellent, so beginner books are unneccessary.

Re:don't need a book (2, Insightful)

Pi Kapp 142 (582241) | more than 12 years ago | (#3695221)

I disagree, lots of people who are beginners would not know where to begin when trying to use PHP or MySQL. The documentation is great if you already have a basic understanding of what is going on, otherwise it is like Latin to y ou. Examples of what can be done lets you see why certain things are set up the way they are for a given language.

Re:don't need a book (1)

Richard_at_work (517087) | more than 12 years ago | (#3695351)

That all depends on waht type of beginners they are. If they are previous coders who are moving to a new language, then the sites are enough, as thats exactly waht i did. i bought a couple of books, mainly WROX ones, and found the php ones to be shite.
For total beginners, then yes, maybe they will need a bit more to learn the proper structure and methods, but thats more of a true beginner thing.
Me, myself, i use these sorts of books, and articles on the internet jsut like them, to stop myself reinventing the wheel. I look at the stuff they do and then think of any projects im currently part of that will benifit from the methods and stuff.

WTF?!?! (-1)

k0osh.CEOofCLIT (582286) | more than 12 years ago | (#3695332)

I claim this FRoSTy PISS for CLIT.
AC's hang out in #bearcave on EFnet

Re:don't need a book (-1)

YourMissionForToday (556292) | more than 12 years ago | (#3695390)

Future Slashdot headlines Ask slashdot: deploying Linux in a business environment? Posted by Hemos [hemos.net] on Monday April 22, @11:48PM

from the justifying-my-unhealthy-fixation dept.

An Anonymous Coward writes "I have a job where I'm real important and I get to take care of 2 NT servers, a bunch of workstations, and an AIX box that runs our database. My boss aksed me about the possibility of upgrading the other day. I told him that we should go with Linux because it's free, and you can write scripts and stuff. Also Ihave it running on all my 386 boxen at home. Has anyone ever used Linux in a business environment before? Update: Slashdot appears fourth when you type in 'Linux' on google [google.com] .

Re:don't need a book (1)

earthpig (227603) | more than 12 years ago | (#3695494)

i hole heartedly dissagree.

unless the have changed receintly, i 've found the online documentation for both php and mysql the most frustraing. as i beginner, i spent countless frustrationg hours getting nowhere with the online documentation.

almost all gpl free gnu open source documentaion about as helpful as continually hitting my self in the head with a hammer.

The book (0, Troll)

HFXPro (581079) | more than 12 years ago | (#3695170)

Glad to see another book on PHP and MySQL usage. Maybe now I can make some site that kicks the blank out of my friends who has all have caught the .Net virus.

Re:The book (1)

HFXPro (581079) | more than 12 years ago | (#3695330)

Oh my god I used "has" rather then "have" on that last sentance. Also lots of bad grammer in that post. *Sarcasticly says to self* >> Perhaps its time I take another English literature that my university forces me to take. All that English literature really helps me to learn proper programming techniques.

Oh shit I'm talking to myself again.

Re:The book (1)

geekopus (130194) | more than 12 years ago | (#3695331)

I have to admit that I sympathize with this sentiment.

So many of my friends seem to think it's inevitable that .NET will be the only web platform out there.

It's really depressing. Microsoft won the public opinion war a long time ago (a clear sign comes when you ask an average user what kind of computer they have and they answer Office 98), and now they seem to be swaying developers as well.

Office 98 is a Mac. (0)

Anonymous Coward | more than 12 years ago | (#3695515)

Lol, you got your own example wrong!
office 95 = windows
office 97 = windows
office 98 = macintosh
office 2000 = windows
office 2001 = macintosh
office XP = windows
office v. x = macintosh

LAMP systems (1)

NewbieSpaz (172080) | more than 12 years ago | (#3695172)

LAMP systems (Linux, Apache, MySQL, PHP, for the newbies...) work really well and are easy to implement, especially if you know a little C,C++ and basic HTML. Looks like I might have to buy this book, any reference on this helps me...

Re:LAMP systems (-1, Troll)

Anonymous Coward | more than 12 years ago | (#3695238)

It's much easier to setup & administer mysql & php with IIS under windows 2k.

Re:LAMP systems (2, Interesting)

LetterJ (3524) | more than 12 years ago | (#3695271)

And WAMP (Windows, Apache, MySQL and PHP) is a lot more popular than most Linux users will admit. It's a great solution for small intranets. With the improvements in Apache 2 to make it more stable on Windows, it's works well when OS isn't a variable in the equation, but a constant.

ahem (1, Troll)

Pinball Wizard (161942) | more than 12 years ago | (#3695394)

you PHP weenies(kidding) can't hog the 'P' part of the LAMP acronym all to yourselves.


The 'P' in LAMP refers to Perl/PHP/Python.

Only reference you need for PHP (1)

Zach978 (98911) | more than 12 years ago | (#3695420)

Is right here [php.net] .

I've said it before (5, Informative)

wbav (223901) | more than 12 years ago | (#3695181)

And I'll say it again. The best way to learn php is through the php website. [php.net] Go through all the documentation. You will learn more about what actually works and what doesn't than what a book can tell you. A book is always about a version behind PHP, and so learn it through the website.

That's how I learned php 3 years ago, and well, I'm better with php than most.

Real Programmers Learn By Doing (5, Insightful)

kzinti (9651) | more than 12 years ago | (#3695312)

And I'll say it again. The best way to learn php is through the php website.

I've said it before and I'll say it again: the best way to learn a language is by using it. Sit down at a computer with the manuals and start slinging code. You can't really learn a language by reading a book or going to a class. Real programmers learn by doing.

If you want to supplement your programming with a book or tutorial, fine, but keep your fingers on the keyboard. If you want to run sample programs, fine, but experiment and play with them. Change them, tweak them, go off on your own tangents. Better yet: throw out the tutorial as soon as you can write "hello world" and try to write some program of your own design. Keep the language and library references handy, because you'll need to refer to them often, but let your imagination and curiousity be your guide. Explore. Play. Learn. Real programmers learn by doing.

What I tell you three times is true.

--Jim

Re:Real Programmers Learn By Doing (1)

wbav (223901) | more than 12 years ago | (#3695417)

I never ment to understate how important it is to also try what you learn, but with relation to this article, a book is always a version behind, and never quite right. Where as the user contibutions on the php site can give you real insight to how the code works and how you might use it.

Re:Real Programmers Learn By Doing (1)

kzinti (9651) | more than 12 years ago | (#3695459)

My comment wasn't meant as a criticism - in fact what you said about the website doco was right on the mark. I learned PHP myself by downloading the HTML manual and reading it while I played with the language.

But whenever I see someone say something like "The best way to learn programming language Z is to..." it kind of sets me off. Of all the programmers I've known, the best ones always want to get their hands on the compiler first thing when learning a new language. And that's my personal experience too: it's all find and dandy to read something in a book, but deep learning, the kind that sinks in and stays, doesn't begin until I actually use the language.

--Jim

Re:Real Programmers Learn By Doing (5, Insightful)

mooman (9434) | more than 12 years ago | (#3695540)


Better yet: throw out the tutorial as soon as you can write "hello world" and try to write some program of your own design.


This strategy works fine if you never want to be any better than a good programmer (at least in that particular language). Learning by doing is great for getting started but leaves you a far cry from being someone that I'd want to hire.

As someone who has been through close to a dozen different languages, I've come to realize that the syntax is one of the easier things to pick up when learning a new language. What you need guidance on is about best practices in your new language.

It's the old "when all you have is a hammer, everything looks like a nail" dilemma. Just because the using lists is a convenient data structure in, say, ColdFusion, doesn't mean it should be what you reach for first in "language X". This is especially true when maker bigger leaps from compiled to scripted languages (what? Verbose comments slows things down??) and procedural to object-oriented languages. Some of the (sorry, I gotta say it) paradigm shifts are key to writing optimized code in the new language. And you'll never grasp those through trial and error.

So while I'll agree on the point that you have to have some hands-on to master a language, I'll strenuously object to the idea that hands-on can replace a good book (or other training source).

Re:I've said it before (4, Insightful)

dimer0 (461593) | more than 12 years ago | (#3695455)

That's like saying that reading the dictionary is the best way to learn to speak English.

You need something that puts pieces together, puts things in perspective, gives you a 10,000 mile high view and drills down into certain aspects of what it's trying to cover. .

Just being devil's advocate. I learn from source code. After that, I hit websites that dive deep into the subjects (like the main php site), and finally I'll take a college course (community college, mostly) on the subject just to get it on paper that I know it.

Re:I've said it before (1)

jrmann1999 (217632) | more than 12 years ago | (#3695495)

Nevermind those pesky "algorithm design and analysis" topics. Or the theories on how languages are derived(basically making you able to pickup any language in a few hours).

Don't get me wrong, I love just diving in and getting into coding. When I was pre-college I did that daily. Then when I actually learned how to plan what I was doing my code was 100x better. The only thing that diving in gets you is horrible style and structure.

Re:I've said it before (1)

kzinti (9651) | more than 12 years ago | (#3695588)

Learning how to design software, and learning how to implement a design by programming in a language are two different (but related) things. Software design skills tend to apply across broad swaths of languages, though of course design skills change depending on the language: designing for an object-oriented language is and should be different than designing for a non-OO language. (Though an OO language can be reduced to a non-OO language if you don't use it well; who was it that said "A good programmer can write FORTRAN in any language"?)

"Diving in" doesn't necessarily lead to horrible style and structure. A good disciplined programmer can dive into a new language and find ways to transfer his good coding skills to programming well in the new language. Good style is largely orthogonal to specific languages - likewise if you're a sloppy C programmer you'll probably also be a sloppy perl, PHP, or Python programmer.

--Jim

NEWS FLASH! (-1, Flamebait)

j0nkatz (315168) | more than 12 years ago | (#3695183)

Michael is a cock smooch!

It's amazing how far this language has come (0)

ObviousGuy (578567) | more than 12 years ago | (#3695185)

From a Perl script to a full blown niche programming language, PHP is growing like gangbusters.

What's great is that you don't have to use a crippled database like MySQL with PHP, there's no longstanding history or anything tying the two together. Much more capable databases (Postgres, JET, Oracle) can be used with the same amount of ease.

PHP really takes to heart Perl's kitchen sink mindset and puts everything that would be useful to the web developer right at his fingertips. This book looks like a worthy addition to any web dev's bookshelf, though I see it sitting on the desk wide open a lot of the time ;-)

Re:It's amazing how far this language has come (4, Interesting)

LetterJ (3524) | more than 12 years ago | (#3695235)

PHP didn't start out as a Perl script it was a series of little C programs.

I appreciate your pedantry (1)

ObviousGuy (578567) | more than 12 years ago | (#3695262)

But this history of PHP [php-center.de] says that I'm right.

Re:I appreciate your pedantry (1)

LetterJ (3524) | more than 12 years ago | (#3695475)

Then we may have a Bob Dylan-esque "shifting background" kind of thing going on. I based my comment off of a speech I heard Rasmus give. His "history of" focused on building the C programs at work for others to use.

Re:It's amazing how far this language has come (4, Informative)

Skweetis (46377) | more than 12 years ago | (#3695323)

What's great is that you don't have to use a crippled database like MySQL with PHP, there's no longstanding history or anything tying the two together. Much more capable databases (Postgres, JET, Oracle) can be used with the same amount of ease.

Amen to that. I would add a plug for ADODB [weblogs.com] or something similar for database abstraction, which makes PHP a bit more like the Perl DBI (no more separate sets of calls for each database type).

Next, while MySQL is great for small projects (and fast), it really is just a port of SQL to dbm files, and not truly relational, so it isn't great for large projects. As you mentioned, Postgres or Oracle fill this niche quite nicely (I don't really like the Oracle model for data types, but that is my personal bias). I could be mistaken here as I haven't used it much, but isn't Jet the file format used for MS Access databases? Access never seemed very robust to me.

Amazing... (3, Funny)

PepsiProgrammer (545828) | more than 12 years ago | (#3695197)

I was able to download this book off kazaa in PDF form 3 days ago

Re:Amazing... (1, Funny)

Anonymous Coward | more than 12 years ago | (#3695345)

You should've reviewed it for Slashdot.

Re:Amazing... (-1)

Metrollica (552191) | more than 12 years ago | (#3695362)

Rev 13:16-17 is the Biblical prediction of Bill G and Passport

Any Jews around that wouldn't mind quoting Rev 13:16-17?

Re:Amazing... (0)

Anonymous Coward | more than 12 years ago | (#3695432)

And he gives to all, small and great, the poor and those who have wealth, the free and those who are not free, a mark on their right hand or on their brows; So that no man might be able to do trade but he who has the mark, even the name of the beast or the number of his name.

Re:Amazing... (0)

Anonymous Coward | more than 12 years ago | (#3695486)

Note that revelations is part of the new testament, and thus not part of the Jewish faith, only Christian and (IIRC Islamic)

Re:Amazing... (-1)

Guns n' Roses Troll (207208) | more than 12 years ago | (#3695594)

Any Jews around that wouldn't mind quoting Rev 13:16-17?

Waah waaah waaah holocaust holocaust holocaust pity us, nobody likes us, we're the chosen people. waaah waaah waaaah. blah blah blah.

That about sums it up. HTH.

FUCK YOU MICHAEL YOU WEASEL (-1, Flamebait)

Anonymous Coward | more than 12 years ago | (#3695200)

You are a cum guzzling queen.......DIE!!!

KTHXBYE

Yes they are... (-1, Offtopic)

mynads (585237) | more than 12 years ago | (#3695201)

My nads are so big, a buddy of mine was playing football with me, and instead of grabbing the football, he grabbed my nads.

linux only? (0)

Anonymous Coward | more than 12 years ago | (#3695203)

helping people use the common Linux, Apache, MySQL and PHP combination to produce database-backed websites.

when did apache, mysql, and php stop working on OpenBSD, FreeBSD, Solaris, etc etc?

The Web is Dead (0, Flamebait)

Perlguy (17814) | more than 12 years ago | (#3695205)

We all know that the web is dead anyway. Microsoft is going to implement a new feature in office that creates it's own globe (a.k.a.: web). Microsoft is the dominant leader in software technologies and with their position can drive consumers whichever way they want.

Forget PHP, forget Perl, forget Python & Ruby. .Net is where the future is...

Re:The Web is Dead (0)

Anonymous Coward | more than 12 years ago | (#3695248)

The more you tighten your grip, Gates, the more consumers will slip through your fingers.

This is an AC (-1)

k0osh.CEOofCLIT (582286) | more than 12 years ago | (#3695461)

mottoboy's Bear page
B0 f t- w- c+ d- dc g k++ s m e+ h- r
indpls, IN United States
Welcome to trevor's bear.net page. If you like what you read, why not send me an email.

About me:
stocky,hairy,hung 7.5, 160lbs, high-n-tight,bubble but
str8 acting, like nasscar,mottocross,anything outdoors!

What I am looking for:
not real sure, but i will know him when i see him. like many types of men. prefer someone taller than me, 5ft7 or taller hairy is always A+,

A few final words:
honest,careing,considerate,funny,smart,dar eing,thr ill seeker! love the outdoors!

Re:The Web is Dead (2)

LetterJ (3524) | more than 12 years ago | (#3695252)

PHP has an experimental .NET extension and I'm sure several of the others if not all will have one soon if not already.

Deformed Penis (-1)

Metrollica (552191) | more than 12 years ago | (#3695214)

Hi.

I'm twenty five years old, and up until two weeks ago, I was a virgin. Too many celibacy had worn my self-esteem down to the point where I was finally willing to pay for sex. I'll spare you the details of the event, as this is not what I am writing about.

After having completed the act, the prostitute whose services I had rented immediately exclaimed that something had felt weird. With no particular ceremony, she grabbed my now-flaccid member and subjected it to an intense examination, while biting her thumbnail in consternation.

After a brief period, she informed me that my penis was deformed, in her professional opinion. I had spent my entire life without ever seeing another man urinate, so I was not aware that the output usually emits from the end of the head, not the underside, where mine does.

I'd like to know if I should seek the advice of a doctor or plastic surgeon? Is this the sort of thing that can, or even should be corrected? I've lived with it for twenty five years, and it hasn't bothered me. Is there really any reason to worry about this?

Using PHP and MySQL for a website... (0, Troll)

Starship Trooper (523907) | more than 12 years ago | (#3695218)

...that's kinda like using a water pistol in a gunfight, don't you think?

Re:Using PHP and MySQL for a website... (2, Insightful)

LetterJ (3524) | more than 12 years ago | (#3695311)

Of course. Because we know that EVERY website gets 100s of simultaneous connections per second. As a matter of fact, all websites NEED 3-tier load balanced solution with an enterprise database in order to pull SELECT * FROM content WHERE id = $content_id out of that database 100 times per day.

Re:Using PHP and MySQL for a website... (0)

Anonymous Coward | more than 12 years ago | (#3695589)


Yeah, designing a low volume website is all well and good...

... until someone posts a link to slashdot that is.

Re:Using PHP and MySQL for a website... (1)

krammit (540755) | more than 12 years ago | (#3695369)

I don't think that at all.

Re:Using PHP and MySQL for a website... (2, Interesting)

AllMightyPaul (553038) | more than 12 years ago | (#3695397)

Slashdot uses MySQL. I point you to their FAQ: What kind of hardware does Slashdot run on? [slashdot.org]

Re:Using PHP and MySQL for a website... (-1, Flamebait)

Anonymous Coward | more than 12 years ago | (#3695421)

Slashdot goes down like your mother at a crackhouse.

It's not even funny how bad Slashdot is some days.

Re:Using PHP and MySQL for a website... (1)

Starship Trooper (523907) | more than 12 years ago | (#3695541)

Slashdot uses MySQL.
And that's supposed to impress me? The traffic Slashdot gets is insignificant compared to top-tier sites like eBay, Amazon, CNN or even microsoft.com. Even under Slashdot's rather minor load, the site goes down with alarming frequency, despite hosting MySQL on a quad-Xeon machine! Oracle on a box half the size of their MySQL server handles roughly the same amount of load without needing to have scheduled downtime every night at midnight (to cope with MySQL and mod_perl's Swiss-cheese memory management). MySQL is a toy database (no transactions? no subselects? no row-level locking?!), and Slashdot is a toy website in comparison to sites running real web applications. MySQL isn't even a consideration for serious business.

Re:Using PHP and MySQL for a website... (0)

Anonymous Coward | more than 12 years ago | (#3695628)

MySQL has transactions and row-level locking when you use InnoDB under MySQL (which I believe Slashdot does now). Sub-selects are supposed to be in 4.1 I believe.

As for bigger name "serious business" sites, Yahoo! Finance uses MySQL [mysql.com] .

Re:Using PHP and MySQL for a website... (1)

[Galaxie] (40909) | more than 12 years ago | (#3695519)

You either don't know php, don't know enough to be effective, or are one of those people who requests that they need 3 webservers and 3 database servers just to put an average of 20 to 30k of information on a webpage per hit.

Just for reference: http://apachetoday.com/story/2002-06-04-001-06-PR- DT-PH.html

php is being used by thousands of large corporations to run some very vital data, usually off of PostgreSQL, mySQL, or in some cases Oracle.

damn man.. that was a stupid post..

Here's a review... (0, Troll)

digerata (516939) | more than 12 years ago | (#3695219)

Don't use PHP.

Use mod_perl.

I really wish... (2)

Clay Mitchell (43630) | more than 12 years ago | (#3695224)

there was better PostgreSQL support out there. While MySQL is *ok*, PostgrsSQL beats the tar out of it. It supports good old standard SQL syntax, while I have to go look up functions in MySQL. Of course, everything supports MySQL, but it's tough to find apps that support PGSQL. Regardless, my current development platform of choice is JAVA/J2EE + PostgreSQL. That's what I coded Squabble [squabble.org] in. I just wish there was more Open Source stuff out there for Java related stuff...

Another O'Reilly Book (1, Funny)

baldass_newbie (136609) | more than 12 years ago | (#3695226)

O'Reilly is like the Pepperidge Farm of computer books.
"If it's an O'Reilly, it's got to be good."

Sorry to piss on your corn flakes... (-1)

Grape Smuggler (569838) | more than 12 years ago | (#3695309)

That would be Smuckers, not Pepperidge Farms.

Re:Sorry to piss on your corn flakes... (-1)

neal n bob (531011) | more than 12 years ago | (#3695434)

can I give the smuggler a hug?

Re:Sorry to piss on your corn flakes... (-1)

Guns n' Roses Troll (207208) | more than 12 years ago | (#3695616)

Only if you do it down looooow.

Re:Sorry to piss on your corn flakes... (1)

baldass_newbie (136609) | more than 12 years ago | (#3695551)

You're right. Sorry 'bout that.
Two week old baby. Up all night.
Need Sleep...

Re:Another O'Reilly Book (1)

$rtbl_this (584653) | more than 12 years ago | (#3695384)

"If it's an O'Reilly, it's got to be good."

Sadly their Apache and MySQL (at least the first edition - I haven't seen the new one) books undermine this. I used to buy ORA books sight-unseen, comfortable in the knowledge that they'd be good. These days I've learned to check them out first and compare them to any Wrox or New Riders books on the same subject.

Another great book on the topic (2, Informative)

essdodson (466448) | more than 12 years ago | (#3695230)

I recently completed an elective course that was taught around the book "PHP and MySQL Web Development" by Luke Welling and Laura Thomson. I suggest giving this book a good look. ISBN : 0672317842

I've read this one too.... (1, Interesting)

Grape Smuggler (569838) | more than 12 years ago | (#3695237)

I've been entrenched with JSP heavily for the last couple of years, so I haven't familiarised myself with PHP yet. I needed a book that would show me a larger picture than I got in a web developer's job, and showed me how to put it together with more modern techniques.
This book is a perfect example of why I choose O'Reilly whenever in doubt. Chapter 1 is an overview of how web applications are put together. Chapter 2 goes through all the basic PHP syntax (stuff that would take other books several fluffy dry chapters to process). Chapter 3 gets you through all the mySQL and sql basics so you feel comfortable with that, too.
There's no 4 page tutotial entitled: "Using a text editor: Wordpad" There's also no kitch "Employee Database" example cop-out. Instead, Hugh and Dave give a realistic and usable storefront application. This book alone is probably enough for the independent web developer to get a functional site up for her/himself or a client.

PHP & MySQL question (-1, Offtopic)

Anonymous Coward | more than 12 years ago | (#3695267)

Do these programs support Beowulf clustering?

Thanks in advance.

Re:PHP & MySQL question (-1, Offtopic)

Anonymous Coward | more than 12 years ago | (#3695343)

More than this: they support a Beowulf cluster made up of Beowulf clusters.

In fact, I have at home a Beowulf clusters of these.

Well (1)

sheepab (461960) | more than 12 years ago | (#3695275)

You dont really need a book, but I bought one back when I first started php/mysql it was really helpful. Link Here. [amazon.com]

It must a requisite (1)

theManInTheYellowHat (451261) | more than 12 years ago | (#3695281)

Since there was a review about CGI and Perl there must me some PHP review today to be fair.

You all are all wet use sh for all your web CGI / programing / culinary needs. It parses, dices, and slices.

PHP == Perl for girls (-1, Offtopic)

Anonymous Coward | more than 12 years ago | (#3695288)

Somebody had to say it.

Re:PHP == Perl for girls (0)

mrkitty (584915) | more than 12 years ago | (#3695399)

Agreed php coders tend to have more exploitable holes then perl coders. Perl coders learn from their mistakes at least.

Things I'd rather do than build a site with PHP (-1, Troll)

Anonymous Coward | more than 12 years ago | (#3695300)

  • Drive down the Autobahn on a unicycle.
  • Render detailed Maya scenes on a cluster of TRS-80s.
  • Build a two-story house out of cardboard boxes and papier maché.
  • Write a high-performance 3D engine in Visual Basic.
  • Get my wisdom teeth pulled without anesthetic.
  • Write to CD-Rs with a hammer and chisel.
  • Use Linux for daily productivity work.
All of those things would be faster, easier, and more reliable than using PHP to build a web application.

Furst Hypocritical Xian Poast!!! (emphasis added) (-1, Flamebait)

Anonymous Coward | more than 12 years ago | (#3695304)

Pluralists ''would have us to believe that Islamfnord is just as good as Christianity, but I'm here to tell you fnord, ladies and gentlemen, that Islamfnord is not just as good as Christianity,'' Vines said. ''Islamfnord was founded by Muhammadfnord, a demon-possessedfnord pedophilefnord who had 12 wivesfnord -- and his last one was a 9-year-old girlfnord. And I will tell you Allahfnord is not Jehovah either. Jehovah's not going to turn you into a terroristfnord that'll try to bomb fnordpeople and take the lives of thousands and thousandsfnord of people.''

--Jerry Vines, Ph.D.
Pastor/CEO
First Baptist Church of Jacksonville, Florida

Re:Furst Hypocritical Xian Poast!!! (emphasis adde (-1, Offtopic)

Anonymous Coward | more than 12 years ago | (#3695491)

Pluralists would have us to believe that Christianity is just as good as Islam, but I'm here to tell you, sisters and brothers, that Christianity is not just as good as Islam ...Christianity was founded by God, a demon-possessed pedophile who had 1 wife -- and she was a 13-year-old girl. And I will tell you Jehovah is not Allah either. Allah's not going to turn you into a terrorist nation that'll try to bomb people for their oil and take the lives of thousands and thousands of non-Christian people at the whim of your multinational corporations.

Web Application Database security links (1, Informative)

Anonymous Coward | more than 12 years ago | (#3695310)

www.cgisecurity.com [cgisecurity.com]
www.owasp.org [owasp.org]
www.sqlsecurity.com [sqlsecurity.com]

Umm... why not just read the docs? (5, Informative)

Hollinger (16202) | more than 12 years ago | (#3695325)

I learned all I ever needed to know about PHP from the PHP Manual [php.net] . MySQL also includes a somewhat monolithic html file that provides a quick reference, as long as you know SQL.

A useful little tidbit: If you want a quick way to look up information in the PHP Manual, go to http://www.php.net/whatever-you-re-looking-for. For example, http://www.php.net/mysql [php.net] will take you straight to the reference pages for MySQL.

Better yet (if you use Mozilla) (0)

Anonymous Coward | more than 12 years ago | (#3695387)

Create a PHP Bookmark with a location of http://www.php.net/manual-lookup.php?function=%s and then create a keyword (ie phpman). Then in your address bar, you can just type phpman "whatever you wish to search for"

It's excellent. I use it all the time.

I made my website... (-1, Troll)

$0 31337 (225572) | more than 12 years ago | (#3695352)

using a slick,powerfull implementation of IIS with a backend running off of access! It is sooooooo cool! I run the entire site on my 486 windows server over my 14.4 dial up connection. You lamers using MySQL can sux my balls!

Why Not Java? (1)

cbernard (232692) | more than 12 years ago | (#3695378)

If you are designing a new web app, why would you not use Java? The language not difficult to use, and the platform is objectively better architected that PHP.

Re:Why Not Java? (1)

Clay Mitchell (43630) | more than 12 years ago | (#3695514)

Because it's not open source.

Seriously though, that's a very valid question. Aside from the fact that it's not GPL'd, it has a) better development tools, b) more libraries out there for the picking, c) better real live commercial support and d) you can use it for free.

I personally ditched PHP several months ago and aimed squarely at Java. God knows it looks better on a resume...

Re:Why Not Java? (1)

digerata (516939) | more than 12 years ago | (#3695612)

Also, servlets, which are IMHO much better than JSP or PHP, can be used. Servlets more closely mimick the CGI paradigm the same way Perl does.

JSP and PHP are horrible for any type of application that has more than 1 developer and more than one revision of HTML layout. The integration of program logic with output display is the wrong way to do any type of large Web Application.

The creative staff that are responsible for designing the 'look n feel' of the application must coordinate closely with the developers. Each time the creative staff wants to revise something, or try out a new look, they must force the developer to reintegrate the display and logic.

And don't even think about incorporating multiple types of application styles based on who is logged in. Sure you could do it. But try and maintain it in a timely fashion!

The only real world solution to a large web application today is either J2EE or mod_perl.

The truth about PHP (-1)

Metrollica (552191) | more than 12 years ago | (#3695391)

It sucks [xach.com]

But MySQL doesn't do UTF-8... (4, Interesting)

andersen (10283) | more than 12 years ago | (#3695400)

Too bad MySQL doesn't do UTF-8. That is a major problem for me in adopting it. Anybody know if that is getting fixed sometime soon?

aminamals (5, Funny)

X_Caffeine (451624) | more than 12 years ago | (#3695411)

Chapter this, section that, blah blah, how about the important stuff: What kind of animal is on the cover?

YAAMPB! (1)

MattRog (527508) | more than 12 years ago | (#3695412)

Lord, just what the world needs. *Yet Another Apache, MySQL, and PHP Book*. Anyone else thing eleventy-billion of these things is around (eleventy-billion - 2) too many?

wow (0)

Anonymous Coward | more than 12 years ago | (#3695416)

another book on my must read list. next time have a review on the windows registry. No, really. this is "News for NerdS"? Who can't figure this out on there own.

Book has a missleading title (5, Informative)

Neil Watson (60859) | more than 12 years ago | (#3695428)

While I like O'Reilly and have many of their books, this one was disappointing. It should have been called "Building E-Commerce Applications with PHP and MySQL" as most of the book focuses on building an online shopping site.


If that's what you want then it's a good book. If you just want a general overview of the different sites you can design using the php/mysql combination then I think you'll be disappointed. I was.

Transactions? (4, Insightful)

rochlin (248444) | more than 12 years ago | (#3695433)

Does this book include anything on transaction processing?

Since transactions are a relatively new part of MySQL (and so, presumably new to PHP's interface to MySQL), a good part of the value of a new book on the subject of PHP/MySQL website building would relate to that new feature (which would also help with the double-entry problems mentioned in the review).

So, does the book cover this topic or not? I can't tell from this review.

I *hate* DB programming in PHP! (3, Informative)

Just Some Guy (3352) | more than 12 years ago | (#3695437)

In my opinion, PHP just isn't worth the hassle if you're going to be doing a lot of database work. Why? Because no two database interfaces in PHP have the same syntax or featureset! My company was switching a site from InterBase to PostgreSQL and we had to completely re-write the backend routines from scratch:

  • The InterBase DBI requires you to fetch rows sequentially: while($row = $result->fetch_row){ print "
    $row->firstname\n";}
  • The PostgreSQL DBI requires you to fetch rows by index number: $maxNum = $result->rows; for($i = 0; $i < $maxNum; $i++) {$row = $result->fetch_row($i); print "
    $row->firstname\n";}
  • The InterBase DBI allows you to use case-insensitive hash keys: $row->FOO or $row->foo
  • The PostgreSQL DBI requires that the hash key case be identical to the database field name: $row->tableOneISStRaNgeLYCapPED


If you're starting with a new project and know for a fact, beyond the shadow of a doubt, that you'll never be changing database backends, then PHP isn't too bad. If there's an possibility (however remote) that you'll ever move from, say, MySQL to PostgreSQL, then DO YOUR WORK IN PERL! I can't tell you how much I missed Perl's DBI::DBD modules - I could've completed the transition in an hour or two instead of weeks. I know that there are efforts to provide similar functionality in PHP, but it just isn't to Perl's level yet.

PEAR DB abstraction (0)

Anonymous Coward | more than 12 years ago | (#3695528)

There is the PEAR DB abstraction layer [php.net] if this is important to you. I believe there are also a number of other DB abstractions out there for PHP. It's not quite to Perl's level, but it's getting better and better all the time, so it's really not fair to just ignore it.

Re:I *hate* DB programming in PHP! (3, Interesting)

the_radix (454343) | more than 12 years ago | (#3695537)

Actually, I just migrated a database-driven website from MySQL to Oracle without a hitch, all using php.

A database abstraction layer was used which made all the difference. I used dal [sourceforge.net] , which is a nice object-oriented layer that only involves changing a single line of code to change different databases.

Personally, it sounds to me like your company's problem was bad design (not allowing for expansion) rather than php.

Re:I *hate* DB programming in PHP! (1)

AC-3 (47590) | more than 12 years ago | (#3695546)

Someone needs to introduce you to the concept of database abstraction in PHP. Code your classes to the DB class generic calls and then when you need to switch DBs you just swap out the db class with the (Oracle|Postgres|MySQL|Whatever) class and you're good2go.

Re:I *hate* DB programming in PHP! (2)

Just Some Guy (3352) | more than 12 years ago | (#3695574)

Unfortunately, the project was started before any of the current abstraction layers existed (or were usable, at least). Either you used PHP's builtins, or you didn't connect at all.

Were we to start now I would do things much differently, but I still contend that by the time you've started installing abstraction layers, etc., then you might as well use Perl from the beginning.

I have 2 words for you: (0)

Anonymous Coward | more than 12 years ago | (#3695553)

javah, j2ee

Re:I *hate* DB programming in PHP! (1, Informative)

Anonymous Coward | more than 12 years ago | (#3695560)

Take a look at PEAR's DB abstraction layer:
  1. PEAR [php.net]

Database abstraction classes are available (3, Informative)

UsonianAutomatic (236235) | more than 12 years ago | (#3695569)

Not sure if these are the efforts you're referring to but they're available for some of the more widely used backends (MySQL, Postgres, DB2, ODBC).

Yes, there are arguments to be made against DB abstraction layers if you're using very specific features on one platform that might not be available on another (e.g. Postgres' foreign keys and subselects vs. Mysql's lack of them (er, last time I used MySQL anyway))

But if you're doing fairly run of the mill SQL stuff, check out the PEAR DB class [php.net] or ADOdb [weblogs.com] . Either one implements a standard set of methods for interacting with databases regardless of the backend.

phpclasses.org (5, Informative)

djaxl (543958) | more than 12 years ago | (#3695440)

People keep mentioning php.net [php.net] . I have to put my vote in for phpclasses.org [phpclasses.org] . No friendly tutorials here, just the code you need. Functionality ranges from basic stuff like turning recordsets into an HTML table, to more advanced things like data caching.

Big problem with most PHP Books (5, Insightful)

saberworks (267163) | more than 12 years ago | (#3695465)

The biggest problem with all the PHP books out there is that they don't talk about software design or good coding practice. They show you some syntax and some functions and leave you on your way. Most do not discuss things like database abstraction, HTML templates, or even object-oriented programming. Without thought to design considerations such as these, most PHP programs end up being hacks full of HTML code mixed with PHP code mixed with native database calls. This might be well and good for a small script on a personal site, but when you're talking about a commercial-grade application, you really need to have all this separate. You can't expect someone to learn PHP just to change the design of their web site which uses your PHP scripts.

PostgreSQL (0)

Anonymous Coward | more than 12 years ago | (#3695500)

I wish there were more attention paid to PostgreSQL. I have used both and find PostgreSQL to be far better. And from talking with other people who have used first MySQL and then PostgreSQL, they would rather use PostgreSQl. It's a shame that more people don't use the LAPP solution instead of LAMP. I guess when you dont really care how well it works .. just that it works, you end up using MySQL. But I have always found PostgreSQL to be easier to setup, admin, and use PHP with.

ADO for PHP (4, Informative)

Kamel Jockey (409856) | more than 12 years ago | (#3695503)

As someone who does database coding for PHP nearly everyday, I must say the ADO interface that can be found here [weblogs.com] has been a godsend. It makes it so easy to create database independent code with minimal overhead. Of course, this package is open source :)

Chapter 6 (0)

Anonymous Coward | more than 12 years ago | (#3695521)

Looking at the TOC I'm only interested in their solution to page reloads causing unknown exceptions. Does it deal with somebody clicking the Back button?

Rasmus' is the best PHP book I've ever read, (3, Informative)

TheTomcat (53158) | more than 12 years ago | (#3695564)

I just finished reading Programming PHP [oreilly.com] , Rasmus Lerdorf's latest co-authored book.

It's by far the most concise, useful, and down-and-dirty books I've ever read on PHP. Even the usually-useless PHP function reference in this books is a step above the norm.

The book talks about important things like PDF creation, the GD library, and how to extend PHP. Setting up and connecting to a DB is kept to a minimum. Kudos to the man.

S

question - not trolling (2, Interesting)

Ender Ryan (79406) | more than 12 years ago | (#3695618)

I am curious, what does PHP offer that Perl does not? I'm not trying to troll, or start a flame war, I just honestly don't see what PHP gives me.

One thing I see people say is that it can be imbedded into your html, but you can do that with Apache::ASP, and a bunch of others, I wrote one myself for my current job.

Plus, with mod_perl, you can write your own handlers in Perl, which is really great, not sure if you can do that with PHP...

But the number one advantage with Perl, IMHO, is the CPAN.

I just don't see what PHP offers that Perl doesn't already do better.

Now, please folks, I'm interested in hearing what PHP actually offers, I'm not looking for "Perl looks like line noise" or "PHP is Perl for girlies" type comments.

Load More Comments
Slashdot Login

Need an Account?

Forgot your password?