Where does this thing go? It’s probably one of the most common questions you ask. Where does this sugar bowl go? Where do these shoes go? Where does this new box of books go? Where do these receipts go? And since that’s such a common question, it shouldn’t surprise you that when you’re building web applications, you’ve got to ask the same thing:
Where does my information go?
The answer, at least for the kinds of web applications you’ve been building with web pages and PHP, is simple: in a database. Yes, a database is another tool to install and another language you’ll need to learn. But, as you’ll see in this chapter, it’s worth it. If you’re writing PHP code, you need a database, too.
A database is any tool that lets you store information, grab that information when needed, and organize the information you’re storing. By definition, a metal file cabinet is a type of database. You can toss things into it, pull things back out, and use files and labels to keep your papers organized.
You’ve seen that PHP gives you arrays to serve as a sort of programmer’s file cabinet (The $_REQUEST Variable). So is an array a database? It fits the definition in the simplest possible sense, but it’s not going to serve your needs very long. For one thing, arrays and their contents in PHP are trashed every time your program stops and starts again. That’s not a very helpful database. You’d be better off with an old ...