I need to upload csv and import this data to MySQL table.
public function insertData()
{
while (($column = fgetcsv($file, 10000, ",")) !== FALSE) {
$query = "INSERT into deleted_users (email)
values ('" . $column[0] . "'); $query->execute();
}
}
Perhaps the fastest way to bulk load data from PHP into MySQL is to use the
LOAD DATAtool, something like this:This answer loads records with only the
emailfield being assigned. If you want to assign a value for theidandtypecolumns, then you will need a CSV file containing these values.