Build Your Own Database-Driven Website 277
Build Your Own Database-Driven Website Using PHP & MySQL, 2nd Ed | |
author | Kevin Yank |
pages | 295 |
publisher | SitePoint |
rating | 5/5 |
reviewer | Chris Beasley |
ISBN | 0957921802 |
summary | A tutorial-style book for beginning PHP/MySQL Programmers |
Unlike the arbitrary structure exemplified by so many programmers' references, Build Your Own Database Driven Website using PHP & MySQL is written more like an instruction manual, with chapters arranged in the order in which you should use them.
The first chapter explains the installation of PHP and MySQL; the next two cover usage basics. In Chapter 4 you're already pulling information from your database and publishing it on the Web. Chapters 5-10 refine what you've already accomplished, and delve into advanced topics in both PHP and MySQL.
If you're familiar with Yank's original tutorial, on which he based this book, your familiarity will end with the closing pages of Chapter 10. Chapter 11 addresses the storage of binary data in MySQL, a topic that was of great interest to me personally as I'd never done it before. In keeping with the rest of the book, Chapter 11 is a step-by-step guide, and explains the storage of binary data in a practical, down-to-earth manner that inspires you to give the book's teachings a try. Already I'm searching for an excuse to build a system, just to experiment with what I've learned. Chapter 12 covers cookies and sessions in PHP. The usage of cookies and sessions is essential to any online authentication or shopping cart system, and this topic makes a great final chapter that complements the book's other lessons.
This book makes good on its promise to teach you everything you need to know to build a database driven Website, but fortunately for us the author decided to throw in a few extras -- these take the form of four reference appendices. Appendix A covers MySQL syntax, which, while covered throughout the book, is easily referenced through this well-organized appendix. Appendix B explains MySQL functions, while Appendix C covers MySQL datatypes in considerable detail, so much so that I found this information easier to use than the official MySQL online reference. Finally, Appendix D covers the PHP functions that are used with MySQL.
If you progress in your programming skills you'll eventually need to buy a complete programmer's reference for PHP, although you probably won't need to buy an SQL reference unless you start using a more robust database solution than MySQL. However, if you want to build your first database-driven website, or even if you have built one before but want a practical reference, I can't recommend this book highly enough. Build Your Own Database Driven Website Using PHP & MySQL will guide you step by step through the development process -- who could ask for more?
You can purchase Build Your Own Database-Driven Website Using PHP & MySQL, 2nd Ed from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This Book Changed My Life (Score:4, Funny)
Now I'm a tired bitter old man.
Damn this book
Damn this book to hell
Who wouldn't? (Score:3, Interesting)
Re:Who wouldn't? (Score:2, Insightful)
Personally, I prefer the ones that do throw in mySQL/PHP/etc. in with the deal - but there's a lot out there that dont, EasySpace [easyspace.com] being one of them. Yeah, I used them for a while, but now I don't - but they still charge through the nose for mySQL and PHP stuff, as well as most other things.
Re:Who wouldn't? (Score:2)
I don't know how massive of a site you run, but check these folks out. [linuxwebhost.com] I've been with them a few years now, and have been nothing but happy. YMMV, of course.
Re:Who wouldn't? (Score:2)
They're insanely expensive. There's no reason to pay a dime more than $1/gig of transfer these days. If you shop, you can get as low as $0.50/gig. These guys are several dollars a gig.
Re:Who wouldn't? (Score:2)
Re:Who wouldn't? (Score:2)
They're cheap (dunno 'bout $1/gig, but you're paying for more than just the bandwidth), the service is pretty good (though, I must admit, I've never had to deal with their customer service department, so I have no idea how good that is; on the other hand, the fact that I've never needed to deal with their customer service department says a lot), and the only difference between the cheapest and the most expensive account types are how many gigs per month you get, how much disk space, etc. (all acco
Re:Who wouldn't? (Score:5, Informative)
Re:Who wouldn't? (Score:2)
And then there are those who have small sites with only a couple of pages that don't need to change very often. Not much call for PHP on those.
Re:Who wouldn't? (Score:2)
For many sites that get
Re:Who wouldn't? (Score:4, Insightful)
opening a database connection for every visitor on every page is suicide if you only have a single server
Re:Who wouldn't? (Score:5, Interesting)
I imagine most Slashdotted sites die from network starvation long before their machines come to a grinding halt.
Re:Who wouldn't? (Score:3, Insightful)
Um, no.
Real database connection pools (say, JDBC) running through a real application server (say, Resin) instead of a compiled-into-Apache-interpreter (PHP), accessing a robust database (Oracle) can and will run at an extremely high speed even when heavily loaded via Slashdot, etc.
All of these "create your own database-driven site!" beginner books are r
Re:Who wouldn't? (Score:3, Funny)
Re:Who wouldn't? (Score:2)
What's more, there aren't any "Build Your Own Database-Driven Website With PHP and PostgreSQL" books, so you get idiots who can't even bother to write proper HTML suddenly thinking that they can do an enterprise-level site using nothing but PHP and MySQL. MySQL is such a half-assed database that it's embarrassing, yet unless you run your own server, that's pretty much what you're limited to because that's the only D
Re:Who wouldn't? (Score:2)
Umm, you've heard of PostgreSQL [postgresql.org], right?
It's free, and is a much more complete SQL database than MySQL.
Re:Who wouldn't? (Score:2)
I'll grant you, though, that for a business page, or something that updates on a daily/weekly basis, static html is p
Re:Who wouldn't? (Score:4, Insightful)
On a counterpoint, some homepages have dynamic content of some sort that you just can't do with static HTML. It's all a matter of what you're doing, not who you're doing it for.
Also, some people put up private pages as a way of teaching themselves the ins and outs of running webpages. Those pages can quickly include all sorts of bells and whisles including dynamic content, flash, etc. Additionally, those sights can look good on a Resume since it shows the person has enough interest in the technology to play with it outside of the workplace.
Don't forget Maintenance (Score:2)
Personally I use mod_perl to maintain a cache. The backend PHP will clear the cached pages as necessary. If an uncached page is requested mod_perl passes it on to PHP to generate it and pops a copy in the cache.
My clients can then update their contents (job adverts) as often as they like and my site will keep the navigation menus up to date.
I also scrape content from our partners.
In this way I can forget about t
Re:Who wouldn't? (Score:2)
Dynamic content with web-based multi-user editing is why I use php/sql on my somewhat smallish site.
Re:Who wouldn't? (Score:2)
Just make your navigation thingy a seperate HTML file (but without the <head>, <body>, and <html> tags; basically, just the bare HTML for your navigation thing) and then include it on your main page via SSI. Very very simple.
Or, you could have a Perl/PHP backend that generates static HTML pages for you whenever new content is uploaded or existing content is changed, giving you the best of both worlds: dynamic content, but without the
Re:Who wouldn't? (Score:4, Insightful)
It depends on what type of content you're putting up. I wanted consistent navigation from page to page and easier maintainability; server-parsed HTML is sufficient for that task. It also allows me to serve up either proper HTML and CSS for browsers that can handle it [mozilla.org] or broken, non-standard HTML for crappy non-standards-compliant browsers [netscape.com]. While I use MySQL for logging server activity (when I dumped access_log into the database, the database was smaller than the text file that created it), the only "content" I've ever served up from it was statistics of how many tens of thousands of times infected IIS machines had tried to pass their bugs on to my server (done with server-parsed HTML and a shell script with the query). For mostly-static content on a small to medium website, is there any reason (other than "because I can") for shoving every website into a database?
Such as this one [windsurf.dyns.cx], which took forever to load because the images appear to have not been optimized? Looks like invalid HTML [w3.org] with a big table in it.
(Why do I get the sneaking suspicion I've just been trolled?)
Re:Who wouldn't? (Score:2)
You make things as flexible and dynamic as possible on your (the webmaster's) end, then you process everything into static pages. This moves all of the heavy-lifting offline. This will cover most sites.
Chapter 16 (Score:4, Funny)
Which effect? (Score:3, Funny)
Were you refering to the Slashdot-caused bandwidth spike?
Or did you mean the "I can't spell" Slahdot effect?
Sorry... it's so unclear what you meant..
Re:Chapter 16 (Score:2)
You seem to be doing a great job at this.
The thruth is... (Score:5, Interesting)
Re:The thruth is... (Score:5, Interesting)
The interesting thing is, I've recently have had to start learning Java / JSP / PL/SQL / Oracle. Documentation is a nightmare. There just doesn't seem to be one end all be all on stop shop for my Java documentation needs, there's about 20 relevant manuals that I need to sift through to find out one thing, and there's about 20 different ways to implement your site. Ok are we going to build our own tag libraries, conform to J2EE, use java beans, just do straight jsp, on what classes should we make and for what? What stuff should be stored in PL/SQL, etc etc etc. It's crazy.
PHP is a dream come true, ease of use wise. It may not be the fastest thing in the world since it's just a scripting language, but there's the Zend caching engine that can help quite a bit. There's just something to be said for reading PHP code from top to bottom and know exactly what's going on. And being able to pay a cheap PHP monkey to code your site for you, instead of paying an expensive Java/Oracle programmer with 10 years experience.
Re:The thruth is... (Score:2)
Re:The thruth is... (Score:2)
I am not a programmer.
So when the documentation is telling me what something does, RARELY does it provide an example that makes sense. it's all documentation for programmers, outlining functions and classes and things I've never heard of
I want to learn PHP/MySQL because I want to be able to build tools to use as a sysadmin, and for fun, but most tutorials are made for pe
a tad forgetful are we? (Score:5, Funny)
sounds simliar (Score:3, Interesting)
Good to see more 'tutorial' style books coming out - its the real world examples that springboard a beginner's skill level w/ a new language.
I'd much prefer to see this type of tutorial book in the hands of a n00b than a straight-lexicon or syntax book w/o examples of actual apps you can build. Sounds like a good one, based on the review.
oh the irony.... (Score:2)
xao
Sounds good... (Score:4, Insightful)
I mean, do we really need *another* book that tells you how to program in PHP and how to use MySQL?
Anyway, from the review, I suppose this would be a good replacement for those books. I just think what we need is something more.
Re:Sounds good... (Score:3, Insightful)
Yes, but having a choice of books is helpful to beginners; especially considering that not every author's writing style or code examples work for every budding developer out there. Choice is good. There is still plenty of room for the improvements you sighted, tho, but I don't think that lack of coverage on those concepts in this particular book denigrates its quality or usefulness.
Re:Sounds good... (Score:3, Troll)
Re:Sounds good... (Score:2, Interesting)
Re:Sounds good... (Score:2)
Re:Sounds good... (Score:2)
I don't know what it is about PHP that I dislike so much; perhaps it's the sucky perl-like syntax, or the lack of API packages (or rather, I should say the plethora of built-in functions), or the fact that so many PHP purists these days insist that you can't use PHP for templating any more (thus running contrary to the original purpose of the language) and that you have to print all your html with print statment
Re:Sounds good... (Score:3, Informative)
Perl-like? It's C-like, if anything, which makes it easy for someone who has experience in C or Java to pick up.
or rather, I should say the plethora of built-in functions
What's wrong with lots of built-in functions?
so many PHP purists these days insist that you can't use PHP for templating any more (thus running contrary to the original purpose of the language) and that you have to print all your html with print statments inside a single tag.
I've never come
Re:Sounds good... (Score:2, Insightful)
Perl is C-like in a lot of ways too. More so than PHP. So I think its fair to say PHP is Perl like, some kind of hacked version of Perl though.
What's wrong with lots of built-in functions?
They are hard to remember and they have names_that_are_entirely_too_long(). Both Python and Perl have ways to group functions together into proper namespaces, something that PHP really lacks. I don't care th
whatever, dude... (Score:3, Insightful)
I agree with you that PHP's functions are awkward, but I'm sure you can find a way to implement namespaces in PHP--PHP has classes, it has hashes, and it has an eval() function, so you can probably figure something out. What I really hate is how PHP handles variables and scoping--that's really criminal. Also, anonymous subroutin
Re:whatever, dude... (Score:2)
Perl doesn't always require braces. I love embedded regexs and one character variables (though I know a lot of people don't).
Totally agree with you on anonymous subs, and the scoping.
I don't think it's difficult to be a competent PHP programmer--it's just like being a competent programmer.
I agree with you here to. The problem I see is since PHP has a function for everything you get people who just throw functions
Re:Sounds good... (Score:2, Interesting)
And what sort of syntax does Perl have, lisp-like?
Perl has C-like syntax, so Perl-like is the same as C-like (i.e., it's easier for a machine to read than a human, so it sucks).
For doesn't-really-suck syntax, one has to look at something like Dylan, or SmallTalk, IMHO.
Re:Sounds good... (Score:3, Informative)
Re:Sounds good... (Score:2)
People need a book that lets them understand what the hell is going on when they re-use someone else's code. Everything I've ever done for myself or others in php has basically been code-reuse. Download the phpnuke or postnuke scripts, configure it then edit the ones to fit some dynamic modules that you need specific on your site. I have never ran into anyone that has ever written a php/mySQL application from scratch, and why would you when
Affiliate link? (Score:2, Insightful)
Re:Affiliate link? (Score:2)
Imagine a business trying to make money of their content...
All 295? (Score:3, Insightful)
All 295 pages, every day? Wow... the only way this would be true for me is if I forgot how to count all the way up to 295 and had to make use of the page numbering.
Seriously, will somebody reset the hyperbole detector? Mine keeps going off.
Measurement of book length is meaningless (Score:5, Insightful)
Just because a book is long, doesn't mean it's useful.
like the great quote
The Ten Commandments contain 297 words. The Bill of Rights is stated in 463 words. The Lord's prayer has only 67. The story of creation in the Bible uses only 200 words. Lincoln's Gettysburg Address contains 271 words. On the other hand, a recent Federal directive to regulate the price of cabbage contains 26,911 words.
I personally find, the bigger the book, the more difficult it is to navigate and the less useful it really becomes. Quick, short, to the point explanations are almost always better than long details drawn out explanations that I don't have the time or the desire to read.
Re:Measurement of book length is meaningless (Score:2)
To avoid are books with a large number of pages which are neither useful nor entertaining - like most of the
Re:Measurement of book length is meaningless (Score:2)
I personally find, the bigger the book, the more difficult it is to navigate and the less useful it really becomes.
mega biblion, mega kakon - Kallimakhos, one of the librarians of the Library of Alexandria. The Greek is easy enough you can probably figure out what it means on your own without knowing Greek; kakos means "bad."
save your money (Score:3, Informative)
Basically, it's a tutorial (build a php/mysql website in 10 steps!). There are plenty of online resources (like devshed) that do tutorials like this all the time. (Note to slashdot editors: devshed spell checks submissions!). If you like to read on the john, this book might be for you. Chances are, you'd be better off to save your money for a mysql or php reference book.
Nice, timely review - the book is out of print (Score:5, Informative)
You know, it might be useful if Slashdot book reviews were limited to books that are currently in print!
Re:Nice, timely review - the book is out of print (Score:3, Informative)
Re:Nice, timely review - the book is out of print (Score:3, Informative)
Better Solutions? (Score:3, Funny)
This book should be good because... (Score:2, Informative)
A bit of advice... (Score:2, Funny)
Web Database Applications with PHP & MySQL (Score:5, Insightful)
Just how many sites need to be dynamic? (Score:4, Insightful)
What ever happened simply to static web pages that are nice and simple, and dish out the data without all that overhead?
Re:Just how many sites need to be dynamic? (Score:3, Insightful)
Or better yet a set of simple, concise data files and a batch method for converting it to static HTML after updates for display on the web. What's this internet coming to?
My personal experience... (Score:2)
Or better yet a set of simple, concise data files and a batch method for converting it to static HTML after updates for display on the web. What's this internet coming to?
Actually, I started out developing my website with every single page being dynamically generated using a cgi script. I did it mostly because it was 'cool' to have a 'dynamic' website. I quickly realized that my pentium 166 mHz (which is my webserver) wasn't doing so hot serving up lots of dynamic pages. So it took a slow computer to ma
Re:Just how many sites need to be dynamic? (Score:2)
Or better yet a set of simple, concise data files and a batch method for converting it to static HTML after updates for display on the web.
Sounds like you're talking about Bloxsom [raelity.org].
Re:Just how many sites need to be dynamic? (Score:2)
I wasn't... but I will be next time!
Re:Just how many sites need to be dynamic? (Score:2)
Your Answer: Moveable Type (Score:2, Informative)
There are many plugins [mt-plugins.org] available for it, too.
All you need is CGI (perl) support on your server -- it doesn't require a database and the site it generates is based on static pages (partially) updated every time the admin makes a change.
Re:Just how many sites need to be dynamic? (Score:2, Informative)
On a more serious note, it depends on what the site does. Having built a fair number of sites--both for myself and, as part of my job, for big companies--I can say there are pros and cons to driving your site from a database.
Databases are primarily useful when you have a consistent structure to your content and you need to be able to update that content easily. When I built this site [fractalus.com] it was done from a database, bu
Re:Just how many sites need to be dynamic? (Score:2)
Even if your pages are relatively static information, if you want to change the design for 100 pages, it becomes a real pain in the ass to manually go through and change them one by one. You can use SSI for a very small percentage of cases
Re:Just how many sites need to be dynamic? (Score:5, Funny)
Re:Just how many sites need to be dynamic? (Score:2)
Belloc
Re:Just how many sites need to be dynamic? (Score:2)
Amazon bad, BN good... (Score:3, Informative)
Damn... (Score:2, Funny)
... I can't find the PDF on kazaa yet..
Good grief another one? (Score:2)
Maybe I'm just bitter because of my extreme hatred for PHP.
Download the First Four Chapters (Score:3, Informative)
Sitepoint (the publisher) has them here [sitepoint.com]. The downside is you have to give them your email address first.
Yet another... (Score:2)
http://slashdot.org/search.pl?query=php+mysql&op=s tories&author=&tid=§ion=books&sort =1
I'll be honest, I'm just bored of seeing reviews of yet another PHP/MySQL book every few days.
This book misses the mark (Score:5, Interesting)
You have uncommented code with embedded HTML that is database specific. Don't get me wrong... if you have a small project that works with a quick hack, then that's ok.
With any modern PHP project, what's wrong with using templates, PEAR, and object oriented programming? Most PHP books out there tend to spin the mantra of PHP and MySQL or Postgresql without taking the time to show how to use PHP in a modern context where it deserves to be. Thus much PHP programming gets scoffed at because it tends to be unmaintainable.
I'm sorry, but at this point I'm unable to recommend almost any of the PHP books out there. They mostly encourange terrible PHP system development practices -- embedded HTML, database specific coding, non OOP development.
There are a few sites that are showing the light. phpclasses.org [phpclasses.org] only has OOP based PHP programs and the tools you need to use templating, mailing, databases in a thoroughly modular manner, and dont forget the PEAR site [php.net] which documents and make available the excellent PEAR classes for PHP.
A few other sites also are preparing PHP libraries and development environments that are a joy to work with.
For PHP public www information is better that 99% of the books out there, and in the case of this book... 100%
Re:This book misses the mark (Score:2)
Re:This book misses the mark (Score:3, Interesting)
Hmm.... I don't question your experience... but I've found that if a server app is written using classes and such it's much easier to go back and plug in a SOAP wrapper to the "business objects".
For example, GForge [gforge.org] has a bunch of classes that we've wrapped via SOAP, so now a Java client can do something like:
Client c = new Client("my.gforge.host", "myproject");
client.login("tom,"fiddlesticks");
Bug[] bugs = client.getOpenBugs();
Fun stuff!
Yours,
Tom
Re:This book misses the mark (Score:2)
Re:This book misses the mark (Score:2)
???
OO code can be written as poorly as procedural if people don't understand how to model the particular data in a good way *for the project*. It's just another skill. I'd take well done procedural PHP over hacked/crap OO PHP of course, but ideally, well-written OOP is both maintainable and easy to work with.
Re:This book misses the mark (Score:2)
I agree 100% with this. I started with php but have moved on to mod_perl, mostly because php books encourage lazy, one shot coding. I've got hundreds of lines of code I am rewriting right now because I have to switch from MySQL to Postrges. If only I wou
Acronym abuse -- WTF is PEAR? (Score:2)
Warning!! Lots of typos that stopps a learner cold (Score:5, Informative)
I bought this book a few months ago to learn just what the title says it teaches. Unfortunately, it had many, many typos in the code examples that resulted in me being stopped cold.
One would need to already know a lot about PHP to know what needed to be fixed. Sadly, there was no online "errata" for the errors that stopped me cold. I think there was an online errata, but it didn't list many of the errors that stopped me cold.
It was only due to my posting the non working code online and getting strangers who already knew PHP to point out what was wrong that I was able to proceed -- at least until the next non corrected error that stopped me cold again.
Finally, In disgust, I gave up and bought the Wrox book (by Welling?) that just came out with a second edition.
What's sad is there is no excuse for the lack of an online errata for the errors that stopped me codl time and time again. I had the latest edition of the book.
IMO, save your money and time -- buy the Wrox book instead and make PROGRESS learning PHP and MySQL.
Despite Assurances (Score:2, Informative)
Though slashdot was certain that I could:
Barnes and Noble assured me that, indeed:
I cannot. There is one used copy of the book available. If they knew they had the only copy, it'd probably be on e-bay.
Order Directly From Sitepoint (Score:2)
S
Best PHP templates? Smarty! (Score:3, Informative)
It has a great user manual, but I would welcome a good PHP book that deals with Smarty templates.
smarty.php.net [php.net]
Wish I could say the same for Geschwinde & Sch (Score:2, Informative)
Get the book here: (Score:2)
The home page [sitepoint.com] of SitePoint has a lot of articles on planning, designing, and coding (client- and server-side) for the web.
There's even a picture [sitepoint.com] of the pretty-boy author.
dejavu (Score:2)
The only explanation I ca
Job mystery solved (Score:2, Funny)
Re:PHP Too slow (Score:4, Informative)
obviously you dont know about this: http://apc.communityconnect.com/about.html [communityconnect.com]
Turck MMCache (Score:2)
Seems very fast and actively developed.
Re:HOWTO-Build a DIY DB-driven site (Score:3, Informative)
Daniel
Re:HOWTO-Build a DIY DB-driven site (Score:3, Interesting)
Re:This book isn't available. (Score:2)
Re:This book isn't available. (Score:5, Interesting)
Well actually, most local bookstores that want to stay in business have stopped trying to beat Amazon and bn.com and decided to join them by offering used & hard to find books via their affiliated dealers programs.
Unfortunately, just one copy of the hardback version was (sold within the last few minutes while I was writing this post) available through bn's affilliate system, and none of either edition are available through Amazon's affiliates. Though the paper back version [amazon.com] is available through Amazon.
If there are local stores out there that have the book available, they might want to consider selling the book through Amazon or bn.com. After all, listing (at least on Amazon [amazon.com]) is free.
BTW NineNine, we miss you [plastic.com]!
Re:This book isn't available. (Score:2)
Re:Help with Mac OS X? (Score:3, Informative)