MySQL round down decimal number to nearest 0 or 5

Inspired by this post, I came out a way to round down a decimal number to nearest 0 or 5 in MySQL.

For example: 1.27 -> 1.25, 3.23->3.20

MySQL code:

SELECT TRUNCATE(value * 2, 1) / 2;

New syntax for new MySQL

Downloaded new version of MySQL database, version 4.1.12. Just like usual, many new features.

When I execute my old PHP programs (version 4), there is an error occured that I can’t connect to my new MySQL database — old password is not usable.

After searched the net, found few ways to overcome this as shown at http://dev.mysql.com/doc/mysql/en/old-client.html

So I have to reset the password at MySQL Command Line Client so that my old PHP program can connect to the database, and it works.

If using PHP version 5, there is a new extension to connect to MySQL version 4.1 and above, that is mysqli (short of MySQL Improved), documentation at http://php.net/mysqli. So in future we need to work with database using these commands like mysqli_connect(), mysqli_fetch_array()… 🙂

So should we migrate to PHP5 if using MySQL 4.1 above, or still stick with old MySQL and old PHP4? (since most of the hosting company still having old installation)