Category Creation & Editing Component Complete

Despite my first entries on this system being written a little over a year ago, I've only now finished the component that allows for the creation and editing of the categories that can be associated with a post. Until a few minutes ago, if I wanted to add or edit a category I'd have to open a CLI connection to the server, log in to the database and manually insert or update table rows directly. Now, thankfully, I can just edit a text box ad click "Update" and I'm done. The categories management page is, as you'd probably expect, very simple. There's a couple of tweaks that I have in mind that I may add later, but I'm not sure they'll turn out to actually be necessary—or even useful. So I'm waiting a while to see if other bits I build might benefit from expanding the category management component first before I actually do it. I'm thinking along the lines of categorisation of categories. For example, categories that might only apply to pictures or some that may only apply to entries that get posted. Some might only apply to particular sections of the site and so on. Although thinking about a bit more now, it sounds like it could just turn out to be heaping on the complexity with negligible benefit.

The relative simplicity of it, in fact, gave me the chance to have a bit of an experiment with the interaction between PHP and MySQL at the same time as building it. The database interaction was small enough that if I completely fouled it all up and forgot what I was doing it didn't really matter because starting again wasn't much work anyway. It turned out that I didn't have to start again from scratch, but it did get so weird that I had to strip it out and make a stand-alone test case to figure out what the hell PHP was doing.

I plan to make a post about it fairly soon and hopefully submit a bug report too. I don't hold out much hope for a sensible/timely fix though. This is PHP we're talking about here. The crazy language where API naming conventions seem to be used and discarded at random and individual methods that should constitute a complete Interface seem to just get picked out and tagged on over very long periods of time. My favourite example of wich is (again) from the MySQLi extension. The commit() method that you'd use to commit changes made to a table (or tables) in the current transaction was in PHP from version 5.0. However, if you wanted start the transaction that would be commit()ed to the database, you were out of luck. You could undo the changes you couldn't make in the transaction you can't start because rollback() was there along with commit(), but you had to wait until PHP 5.5 (according to the documentation) to be able to start a transaction with begin_transaction(). That is literally years!

Thankfully, there were many ways around this problem; which is the reason why I never have, and probably never will, use the method. Curiously, there's also a red warning on the method's page in the documentation that says that the method is undocumented. So the page is, in essence, warning you that it doesn't exist. Maybe I'm missing something, but to me that's just typical of the nonsense I've come to expect of PHP and its documentation.

Categories