Q:

Write on YAML file using php in codeigniter Framework

I'm using YAML library with codeIgniter and I was adding data manually but now I decided I need to add it automatically and I'm asking how to add a line at the end of a .YML file?
Clarification: 
when I insert some data in the database in the same time I need to store some of it in the YML file ( for other use )
no the data is inserted successfully in the database but it doesn't in the YML file (it always return Unable to write the file) after I tried to use this method which I thought it's gonna work: 
   $title = $title-en.' :'.$title-fr;
   $this->load->helper('file');
        $msg = "non";
        if (!write_file(base_url().'assets/data/data.yml',$title, 'a+')){
            $msg = 'Unable to write the file';
        }else{
            $msg = 'File written!';
        }

     echo $msg;

A:

You cannot write to a file using a URL ie http://www.domainname.com/assets/data/data.yml
You need to use a PATH. ie 
if (!write_file('.assets/data/data.yml', $title, 'a+')) {
...
}

So if you use the correct path and the file has it's permissions set to writeable, that should help.

