vendredi 23 septembre 2016

SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version

I am trying to upload complete CSV file in Laravel code looks like this

public function testfastupload(Request $request)
       {
           $file = Flag::where('imported','=','0')
                       ->orderBy('created_at', 'DESC')
                       ->first();
            $file_path = Config::get('filesystems.disks.local.root') . '/' .$file->file_name;


            $query = "LOAD DATA LOCAL INFILE '" . $file_path . "'
            INTO TABLE testdb
            (name,
            phone,
            dob,
            addresse,
            @created_at,
            @updated_at)
            SET created_at=NOW(),updated_at=null";

            DB::connection()->getpdo()->exec($query);
       }

I am getting error as follows

SQLSTATE[42000]: Syntax error or access violation: 1148 The used command is not allowed with this MySQL version

I have also installed

sudo apt-get install php5-mysqlnd

The error report looks like this

`at PDO->exec('LOAD DATA LOCAL INFILE '/var/www/testUploadExcelApp/uploadExcel/storage/app/379ea12c68e382a438592b4da305a3c2.csv' INTO TABLE testdb (name, phone, dob, addresse, @created_at, @updated_at) SET created`_at=NOW(),updated_at=null') in ExcelhandellerController.php line 113

Can any one help me out



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire