Monday 3 September 2018
Subscribe to:
Post Comments (Atom)
+---------+--------+-------------+ | Post id | Name | Designation | +---------+--------+-------------+ 101 noYon designer 102 nakib accountant 103 nishi developer +---------+--------+-------------+
Post id,Name,Designation 101,noYon,designer 102,nakib,accountant 103,nishi,developer
//get the csv file
$file = $_FILES[csv][tmp_name];
$handle = fopen($file,"r");
fgetcsv($handle); // Discard first line. If we know the maximum line length
// add it as second argument: it's slightly faster
while( $data = fgetcsv( $handle) ) {
$query = mysqli->query( "INSERT INTO table (post_id,name,designation) VALUES ('".
implode($data,"','")."'";
}
INSERT
like this:INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);
Hello Friends! I am Ramana a part time blogger from Hyderabad.
0 comments:
Post a Comment