As documented under LOAD DATA INFILE
Syntax:
When processing an input line,
LOAD DATA
splits it into fields and uses the values according to the column/variable list and theSET
clause, if they are present.
In other words, the column list should describe the database columns (or user variables) to which each the input fields should be assigned (rather than describing in which input field each database column can be found). This is, of course, obvious when one realises that the input file need not contain field names and thus it would be impossible to adopt the latter approach in all circumstances.
Therefore, you want:
$columns = '(vendor_id, receiver_no, purchase_order_no, destination, po_status)';
You will also need to add IGNORE 1 LINES
to the command in order to skip the first line (with field names):
$affectedRows = $pdo->exec("
LOAD DATA LOCAL INFILE ".$pdo->quote($csvfile)." INTO TABLE `$databasetable`
FIELDS TERMINATED BY ".$pdo->quote($fieldseparator)."
LINES TERMINATED BY ".$pdo->quote($lineseparator)."
IGNORE 1 LINES ". $columns);