Search
 
SCRIPT & CODE EXAMPLE
 

PHP

mongodb uploading csv php

<?php

$mongo = new Mongo("mongodb://192.168.1.7:27017");

$collection = $mongo->test->cartoons;
$row = 1;
 $handle = fopen(dirname(Yii::app()->request->scriptFile).'/images/importcsv/upload.csv', "r");
    while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
        $num = count($data);
       echo "<p> $num fields in line $row: <br /></p>
";
       $row++;
       $users = array();
       for ($c=0; $c < $num; $c++) {
            echo 'data--'.$data[$c] . "<br />
";
        }
       $users[] =$data;
       var_dump($users);
       $collection->batchInsert($users);
    }
?>
Comment

PREVIOUS NEXT
Code Example
Php :: Personnaliser le logo de connexion WordPress sans plugin 
Php :: Movie Name -inurl:(htm|html|php|pls|txt) intitle:index.of "last modified" (mp4|wma|aac|avi) 
Php :: livewire modal to datetime-local 
Php :: simple php round When a parameter is passed with a specific precision value 
Php :: js data php 
Php :: code on editing an image in database in php 
Php :: how to remove public folder from url in laravel 8 
Php :: if no data show msg and chang style laravel 
Php :: how-to-add-pagination-in-search-results wordpress 
Php :: fix-wordpress-limit-permalink 
Php :: small echo php 
Php :: How to add watermark in FPDF PHP - Parte 1 
Php :: if is gutenberg page php wp 
Php :: jquery ui sortable tables php mysql 
Php :: php pdo check if record exists before insert 
Php :: addcslashes (PHP 4, PHP 5, PHP 7, PHP 8) 
Php :: WP DELETE UNUSED TAGS 
Php :: Assignment By Reference 
Php :: laravel migration unknown column type double requested 
Php :: calculate age from date of birth php 
Php :: html vs php 
Php :: mysqli_fetch_all() expects parameter 1 to be mysqli_result, boolean given in C:xampphtdocscomplete-blog-phpadminincludespost_functions.php on line 31 
Php :: run seeder command in laravel 
Php :: php get list of months by year 
Php :: comparison of two tables in laravel using model 
Php :: laravel Join columns of Day, Month , Year to calculate age 
Php :: laravel get file size uploaded 
Php :: php send 204 
Php :: php function to show nav menu with example 
Php :: wordpress codex get post type woocommerce products 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =