|
|
PHP/MySQL DVD Database Background and MethodologyCertainly I could have downloaded and used any number of existing scripts and databases that do almost exactly the same thing mine does, but what would I learn by doing that? I wrote this mainly as an exercise to learn both PHP and MySQL. First of all, I obtained a CSV file containing a gigantic list of all "Region 1" DVDs ever made (over 21,000 DVDs!). With an Emacs macro and my old out-of-date DVD list, I pulled out the list of just the DVDs I own. With this new smaller CSV file, I then created the MySQL database on my web host server. (For fun, I also created a MySQL database with the entire 21,000+ list. I may also make that available, but large searches can be super-slow.) Next, I searched for some PHP tutorials that also dealt with MySQL. I worked through an employee database example, but altered it as I went to fit my DVD database. Then I started adding features like sorting and seaching, and things started getting more complicated. One of the new things I had to learn was form handling (POST and GET) which I probably should already have known, but somehow I've avoided CGI scripts and the like over the years. Next, I just tried to make it look nice, putting the output into a table, and matching the look to my website's theme. I'll need to redesign things a bit if I want to make this available to others to use. Probably the hardest part was figuring out how to preserve the state of the checkboxes and search criteria after each "submit" or reload. Overall, this was a somewhat simpler project than I thought it would be, but of course there were several little "gotchas" along the way that I had to fight through. It sure would have been easier to do a simple "Guest Book" instead of this, but this was actually pretty fun, and after a few more enhancements, maybe I can add "MySQL" and "PHP" to my resume. What's next?When I first thought about doing this project, I thought it would be neat to have the capability to let friends reserve and check out DVDs using these pages. That might have been a little too ambitious as a first-time project, but I can see it happening sometime in the future. Actually, the first person I showed this too, said "you need to do a movie checkout interface so we can borrow them from you through this interface". So, I'm not the only one who thought of it. Additional plans:
Links
|