Hm, I just realized that MySQL’s REPLACE() is PHP’s STR_REPLACE(). It is more quicker than doing same job in php. Why didn't I know this before?!
The PHP function that I used was str_replace(). If you aren't familiar with the function, here's what it does:
$string = '28/10/2013';
$result = str_replace('_', '-', $string); //becomes 28-10-2013
In MySQL, this is:
Using MySQL's function allows me to fix the problem once and it is faster for a big database.
Again, Why didn't I know this before?!
No comments:
Post a Comment