3.5. $rep = str_replace("1-1.jpg",$row["img"],$rep);

実際に使ってる変数にするとか、htmlspecialchars とか ENT_QUOTES とか ""で囲むとかは適宜やってほしい。