Correct Name Capitalization in PHP

One annoying scenario is when you let users enter their names and then you need to output their names nicely, for example in a newsletter. Some users simply enter their names in upper/lowercase, but obviously when you address them you can’t do the same. On the other hand PHP’s ucfirst() and ucwords() functions are too naive for proper capitalization.
Read more

VirtueMart quick tip: show brand/manufacturer logo in product details

I recently had to provide a VirtueMart/Joomla solution for a customer. If you don’t know what VirtueMart is – it’s an open source ecommerce platform and it’s pretty good too.

They wanted a brand logo to be displayed in the product details, along with some other details. VirtueMart supports Manufacturer details but by default it just shows the manufacturer’s name in brackets, with a javascript pop-up window, that looks pretty ugly.

Fortunately we can add the logo by using the description field of the Manufacturers details and by hacking one file.
Read more

Using MySQL to generate daily sales reports with filled gaps

This is a classic problem but I was surprised to see that there’s not a great deal of info on the web on how to do a proper daily report – one that doesn’t have any gaps when data is missing. In this post I’ll guide you through building such a report using MySQL and PHP for presentation. Obviously, you will need to adapt the code for your needs, but the concepts should be valid for a wide range of similar needs.
Read more

Does your PHP/MySQL app speak Unicode?

I find it very annoying when I come across web apps that still can’t handle non-ASCII characters correctly. In this article, I’ll show you how, with just a few lines of code, you can “globalize” your online app. If you look at the illustration on the left, if you don’t plan for users entering words with “weird” characters, your output will look simply awful.
Read more