phpactiverecord ORM transactions 30 sec error executing time

224 Views Asked by At

Well I'm trying to insert several rows from an csv file to a myslDB, my first attempt (wrong approach) was to trying to insert creating a new object with $o = new Model();

After read/research on the web I saw that what I need is to use transaction, Right now im using phpactiverectord ORM and this is my code:

But still having the 30 sec fatal error

try{
    if (($handle = fopen("somefile.csv", "r")) !== FALSE) {
            while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
                    $someid = $data[4];
                    Usuario::transaction(function() use ($someid){
                     Usuario::create(array("matricula" => $someid));
                 });
            }
            fclose($handle);
    }

}

I think im coding in a wrong way the transaction but I don't realize how to do it. Need some help. Actually the insert is working wha I need is to insert all before the 30 sec error happend, my database is on godaddy btw.

thanks

  • EDIT - This was solve with the set_time_limit function was not a transaction problem. Maybe this question can work for other person I will leave it.
0

There are 0 best solutions below