Definitely wasn't my finest hour of programming today. I made a royal fuck-up by incorrectly writing an SQL statement which led to 141 records in the “images” column to be replaced with the word “nothing”. There's no way to reverse a bad SQL statement once it's executed. Consequently, I lost lots of time trying to fix it. After two hours, I decided to work on a different part of the code. Never been a better time to work on that “add image” feature for the editors. When the insert and modify pages were ready, I returned to repairing the SQL damage by entering the images one record at a time. There's a law of diminishing returns at work here. The longer I spend trying to create code for the repair, the more likely it would be that I'd be finished just biting the bullet and doing it by hand.
Working out a way to display article images in the forum is what led to the debacle. I was able to get the code to display the image if one existed but I couldn't get the Javascript to _ignore_ the image code if no image existed. That is supposed to be straightforward stuff… if image != “” {… that says “if image does not equal nothing then”. It just behaved as if the statement wasn't there and sent me spinning into hacks and workarounds. Needless to say, orthodoxy is safe. Getting creative where creativity is uncalled for leads to trashing 141 records.
I entered about 25 of the 141 image records as of this writing. I'm tired and I seriously doubt anyone will be browsing that deeply into the archive today. With the most recent articles fixed, I'll write some slick code tomorrow night to finish the remaining records. Now I need to find some old code to put the image category of this project to rest.
Creating a dynamic FAQ is the next mission. I thought I'd have that done today. Doesn't matter. It will get done.
——
Laws are for people with no friends.