Sunday, August 27, 2006

Getting into MySql with PHP

Our host for the Random Pub Finder has been providing MySql integration for a while. I've been holding off using it for a while because I was thinking of converting the RPF to ASP.NET. But I eventually decided that was going to be too much like hard work and would break any links in. OK, I could probably do some URL rewriting to get round that but again it seemed like a lot of bother and PHP does pretty much everything we need.

Anyway, I signed up for the MySql integration and I've been pleasantly surprised with how good the phpMyAdmin web interface is. RPF has been running off several text files for the last five years so I had to make quite a few changes to our code but getting the data in to MySql was pretty straightforward (phpMyAdmin will suck in any kind of delimited text file). Setting up phpMyAdmin on my local machine was pretty straightforward. OK, it's not MS easy, but then this is a free bit of software developed by people in their spare time. So I had to tweak a few text config files to get it working and I couldn't get it to play with PHP 5 but PHP 4 is fine for our needs. And now it's working I'm presuming I won't need to touch it again.

Updating the RPF live site is now much simpler, I just insert a new row in a table and a new pub appears on the site. Previously I had to update one of our text files and email it to myself, run to my other half's laptop, download the email and FTP it to our host via a phone modem, because they won't let me connect to the FTP site via our broadband connection. I guess that's because their business model is based on getting revenue from phone calls... 

So, in conclusion, a thumbs up for PHP, MySql and phpMyAdmin. Perhaps I'll stop being an MS fanboy and become a open-source zealot. Time to grow a beard...

No comments: