Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
So things look pretty good…but if you run the code from the previous section, you’ll have some issues. First and foremost, that binary data has all sorts of weird characters on which PHP and MySQL are going to choke. There’s actually always the possibility of running into characters that are a problem, but that’s especially true—and almost always the case—when you’re dealing with binary data.
Once again, though, there’s a utility function for that.
You’ve probably noticed that at almost every turn, there’s a PHP utility function. That’s one of the advantages of a language that’s fairly mature. Well into version 4 and 5, PHP has settled and developed a pretty robust library of handy functions like getimagesize and the one you’re about to use, mysql_real_escape_string.