Q:

REPLACE and IF in expression causes concatenation from previous row

The following sql statement:
SELECT 
    profile_pic
FROM
    (`member`) 
WHERE 
    `active` = 1

produces the following result:
profile_pic
    1_1345694557.jpg
    <blank_value>
    <blank_value>
    <blank_value>

I want the "blank values" to default to "no_prof_thumb.jpg".  
So I created this statement:
SELECT 
    REPLACE(IF (CHAR_LENGTH(profile_pic) > 0, profile_pic, 'no_prof.jpg' ), '.jpg', '_thumb.jpg') AS profile_pic 
FROM 
    (`member`) 
WHERE 
    `active` = 1

Here is the result:
profile_pic
1_1345694557_thumb.jpg
no_prof_thumb.jpg
no_prof_thumb_thumb.jpg
no_prof_thumb_thumb_thumb.jpg

Why does _thumb keep appending itself to the value in the previous row? 
How should I fix my expression? 

Update
This issue occurs on a GoDaddy mySQL database.   I reproduce when it connecting remotely through SQLyog and when I log into GoDaddy and run it through phpMyAdmin. 
However, I cannot reproduce locally nor on sqlFiddle. 
So it must be some kind of configuration issue. 

A:

You needed to use IF outside the REPLACE statement like this. 
SELECT 
    IF (profile_pic = '', 'no_prof.jpg', 
        REPLACE(profile_pic, '.jpg', '_thumb.jpg')) AS profile_pic 
FROM 
    (`member`) 
WHERE 
    `active` = 1

You can also use CASE statement instead of IF like this:
SELECT
  CASE  profile_pic
    WHEN '' THEN 'no_prof.jpg'
    ELSE REPLACE(profile_pic, '.jpg', '_thumb.jpg')
  END AS profile_pic
FROM member
WHERE active = 1;

See this fiddle

