I would to import csv products to mysql using below codes but i don't know what framework to use the data is large more than 100000 products
prepare("SELECT COUNT(*) AS c from products WHERE id=?");
$result = $query->execute([$fields[0]]);
if($query->rowCount()) {
$pdo->query('DELETE FROM products WHERE id = "' . $fields[0] . '"');
print('Deleted existed product to be updated.');
}
$query = $pdo->prepare('INSERT INTO products (id, name, sku,status,variations, price, currency) VALUES (?, ?, ?, ? , ? , ?, ?)');
$result = $query->execute(\[$fields\[0\], ($fields\[4\] ?? ''), ($fields\[5\] ?? ''), ($fields\[6\] ?? ''), ($fields\[9\] ?? ''), ($fields\[10\] ?? '') \]);
// TODO: Soft delete no longer exist products from the database.
$i++;
}
die('Updated ' . $i . ' products.');
}
}