Exception happening while executing LOAD DATA LOCAL INFILE

PDO Connection


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

    $connectionString = 'mysql:host='.$host.';dbname='.$schema;
    $conn = new PDO(
                            $connectionString,
                            $user,
                            $pass,
                            array(
                                PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
                                PDO::MYSQL_ATTR_LOCAL_INFILE => true
                            )
                        );
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

Mysqli Connection


    $conn = mysqli_init();
    mysqli_options($conn, MYSQLI_OPT_LOCAL_INFILE, true);
    mysqli_real_connect($conn,_DBR_HST,_DBW_USR,_DBW_PAS,_DB_NAME);
    $result = mysqli_query($conn, $query);
    if($result){
        echo "yay";
    }

Popular Posts