Method : 1
Method : 2
$handle = fopen("BooksList.csv", "r"); while (($data = fgetcsv($handle)) !== FALSE) { $num = count($data); $row; echo "INSERT into importing(text,number)values('$data[0]','$data[1]')"; echo "<br>"; }
Method : 2
$handle = fopen("BooksList.csv", "r"); $fields=array('category','datatype','date','value'); $table='test'; $sql_query = "INSERT INTO $table(". implode(',',$fields) .") VALUES("; while (($data = fgetcsv($handle)) !== FALSE) { foreach($data as $key=>$value) { $data[$key] = "'" . addslashes($value) . "'"; } $rows[] = implode(",",$data); } $sql_query .= implode("),(", $rows); $sql_query .= ")"; echo $sql_query;
This is the most supportive blog which I have ever observed. I might want to state, this post will help me a ton to support my positioning on the SERP. Much appreciated for sharing.
ReplyDeletehttps://myseokhazana.com