❌ Failed to open qogita_updated.csv ❌ Failed to open qogita_updated.csv ❌ Failed to open qogita_updated.csv ❌ Failed to open qogita_updated.csv $csv_filename = 'qogita_updated.csv'; $product_limit = 300000; $categories = ['Shampoo', 'Conditioner', 'Toothpaste', 'Hair Dye']; foreach ($categories as $category_keyword) { $inputFile = fopen($csv_filename, 'r'); if (!$inputFile) { echo "Failed to open CSV\n"; continue; } $header = fgetcsv($inputFile); $category_filename = strtolower(str_replace(' ', '_', $category_keyword)) . '_products.csv'; $outputFile = fopen($category_filename, 'w'); fputcsv($outputFile, $header); $count = 0; while (($row = fgetcsv($inputFile)) !== false) { $rowText = implode(' ', $row); if (stripos($rowText, $category_keyword) !== false) { fputcsv($outputFile, $row); $count++; } if ($count >= $product_limit) break; } fclose($inputFile); fclose($outputFile); echo "✅ [$category_keyword] → $category_filename created with $count products\n"; }