I absolutely love coding in PHP. Sometimes I get distracted by the glitz and glamour of some of the more popular languages (and their associated frameworks) - and I agree, they have their place. But PHP is in a class of its own.
It's not often I have to worry too much about the minutia of database administration... well, I try not to. But this question on StackOverflow got me intrigued, so I put on my trilby. labratmatt was having a bit of a problem with inserting data into a MySQL table with field defined as DECIMAL(3,2). Can you guess what his problem was? That's right.... 9.99! How did you guess? This has got to be one of the most popular MySQL-related Google searches. The initial problem is easy to solve... correct the presumptuous field definition. However, the underlying problem is really why his data was being truncated, even inserted incorrectly. You may notice the same if you run MySQL (v5.0+) from a default setup on other field types: VARCHAR for example, where you set a maximum field length. When you INSERT data that is too long it simply gets truncated. Not hugely worrying you may think, especially in development and testing phases. True. But this wasn't enough for me, so I went on a ...
UPDATE: We're opening it up to a greater audience. So even if you're not tech/web related, feel free to come along anyway. Yesterday whilst I was in the office (also known as The Vortex), I was reading my Twitter stream — as I so often do — and I came across this tweet from @bostinbloke .
Comments