title: How to find in file line that contains string and add something at the end of that line
body: <p>I have file to edit that contains:</p>
  
  <pre><code>Categories,
  Diamond,10,11,
  Coal,21,21,
  </code></pre>
  
  <p><strong>How to add string at the end of line containing "Diamond"?</strong></p>
  
  <p>What I have is code that can add string at the end of a file but don't know how to make it to add that string in specyfic line:</p>
  
  <pre><code>$function_Result = mysql_fetch_row($function_Ask, 0);
  
  $file_To_Edit = "item_Data.csv";
  $opened_File = fopen($file_To_Edit, 'w') or die("Error. Code:2 - Can not open file $file_To_Edit");
  
  $string_Data = $function_Result[0] . ",";
  fwrite($opened_File, $string_Data);
  fclose($opened_File);
  </code></pre>