Chapter 5. Working with Data Stored in Files: When a database just isn’t enough

Don’t believe the hype...about databases, that is. Sure, they work wonders for storing all kinds of data involving text, but what about binary data? You know, stuff like JPEG images and PDF documents. Does it really make sense to store all those pictures of your rare guitar pick collection in a database table? Usually not. That kind of data is typically stored in files, and we’ll leave it in files. But it’s entirely possible to have your virtual cake and eat it too—this chapter reveals that you can use files and databases together to build PHP applications that are awash in binary data.
Virtual guitarists like to compete
Apparently creating art for art’s sake isn’t always enough because players of the hot new game Guitar Wars are quite enamored with competitive virtual guitar playing. So much so that they regularly post their high scores at the Guitar Wars web site, which you are now in charge of maintaining. Problem is, there isn’t currently a good way to verify the scores.

Text can’t be trusted
Right now players just post up their high scores purely as text, and there have been lots of disputes over whose scores are valid and whose aren’t. There’s only one way to put an end to all this bickering and crown ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access