pada loop while Anda hanya membuat string kueri, dan menjalankan pernyataan di luar loop. Jadi sesuatu seperti ini seharusnya berfungsi (tidak yakin tentang sintaks karena sudah lama saya menulis php tetapi seharusnya berfungsi:
public function initiateInserts()
{
//Open Large CSV File(min 100K rows) for parsing.
$this->fin = fopen($file,'r') or die('Cannot open file');
//Parsing Large CSV file to get data and initiate insertion into schema.
$query = "";
while (($data=fgetcsv($this->fin,5000,";"))!==FALSE)
{
$query = $query . "INSERT INTO dt_table (id, code, connectid, connectcode)
VALUES (" . $data[0] . ", " . $data[1] . ", " . $data[2] . ", " . $data[3] . ")";
}
$stmt = $this->prepare($query);
// Execute the statement
$stmt->execute();
$this->checkForErrors($stmt);
}