Posted inProgramming / Mysql / Mysqli / php

Import csv file data into mysql database using php

Import csv file data into mysql database using php

In this Post We Will Explain About is Import csv file data into mysql database using php With Example and Demo.Welcome on Pakainfo.com – Examples, The best For Learn web development Tutorials,Demo with Example! Hi Dear Friends here u can know to import csv file into mysql using php codeExample

In this post we will show you Best way to implement import csv file into mysql using php demo, hear for how to read csv file in php and store in mysqlwith Download .we will give you demo,Source Code and examples for implement Step By Step Good Luck!.

Example

here show eamples to core PHP with mysql we can easily read the simple CSV file data into database like as a mysql database. CSV (comma separator value) file contain the all data with simple separator comma. functions used to fgetcsv is used to read simple csv data.

index.php

 0) { 
    $file = $_FILES['livecsv']['tmp_name']; 
    $handle = fopen($file,"r"); 
    $name = $_FILES['livecsv']['name'];
    do { 
        if ($data[0]) { 
		$myquery = mysql_num_rows(mysql_query("SELECT user_id FROM user_mst WHERE user_id = '".addslashes(trim($data[1],'"'))."'"));
		if($myquery == 0 ) {
            mysql_query("INSERT INTO user_mst (user_name, user_id,user_file) VALUES 
                ( 
                    '".addslashes(trim($data[0],'"'))."', 
                    '".addslashes(trim($data[1],'"'))."',
					'".$name."'
                ) 
            "); 
		}
        } 
    } while ($data = fgetcsv($handle,1000,",","'"));     // 

	echo '';
     die; 

} 

?> 
 
 
Devloped By : Pakainfo.com Import a CSV File with PHP & MySQL 
 
 
Your simple file has been imported success.

"; } //generic simple success notice ?>

Devloped By : Pakainfo.com - Import a CSV File with PHP AND MySQL Example

select your file:

We are Web Technology Experts and Team who provide you very Important information on Web Development information,Examples and Demo, Interview Questions and Answers, live project problem solution and their solution and online free tutorials – “Pakainfo.com”. 1) https://www.pakainfo.com/ 2) https://www.pakainfo.com/tutorial

Your CSV simple data must be like below : CSV File Sample Data

919898225076, ravi
919974840402, live24udotcom
919898555554, itfiddledotcom
919985666854, MayurDhameliya

Example

I hope you have Got What is import csv file into mysql database using phpmyadmin And how it works.I would Like to have FeadBack From My Blog(Pakainfo.com) readers.Your Valuable FeadBack,Any Question,or any Comments abaout This Article(Pakainfo.com) Are Most Always Welcome.

I am Jaydeep Gondaliya , a software engineer, the founder and the person running Pakainfo. I'm a full-stack developer, entrepreneur and owner of Pakainfo.com. I live in India and I love to write tutorials and tips that can help to other artisan, a Passionate Blogger, who love to share the informative content on PHP, JavaScript, jQuery, Laravel, CodeIgniter, VueJS, AngularJS and Bootstrap from the early stage.

Leave a Reply

Your email address will not be published. Required fields are marked *

We accept paid guest Posting on our Site : Guest Post Chat with Us On Skype