Append/Prepend string to a field in MySQL

Just now I am working with a problem where I need to update a column/field by appending something. I was in a bit trouble for a 2 mins as I was finding a solution for this. First thing came to my mind is

UPDATE `table_name` SET `field_name`=`field_name`+’appending string’ WHERE `field_name`=’xxx’;

I knew this won’t work in my case. It is suitable when I need to SUM up floating point. However, I simply need to append to current value. Within two mins I got the idea that worked 100%. It is:

UPDATE `table_name` SET `field_name`=concat(`field_name`, ‘ appending string’) WHERE `field_name`=’xxx’;

Cool!

Detecting WAP browser

Recently, I have observed that there is a good trend of developing WAP sites in our country. Many young designers are trying to develop WAP sites. Special concentration has seen on ringtone sites, music sites, chat site etc. I have also worked for two WAP sites quite a bit ago. So, today I am posting here a tips of automatically redirecting users to your WAP site.

When does it needed?
Suppose, you have/want two versions of your site. Normal web and wap version. You want that when people browsing your site (let say www.flashgamz.info) from mobile, you automatically redirect the user to www.wap.flashgamz.info. Continue reading →