How do i import a csv file to开发者_运维知识库 phpmyadmin. In one column1\2\3.It should go with out escaping \
Without screen shots....hard...go into phpmyadmin, look for the import tab (top) and start play with it until you get it right.
Any way, this does not belong here, and I am pretty sure this can easily be figured out by experimenting.
in php you could do this.
this should convert the csv file into an array
$csvhead = array();
$leads = array();
if(($handle = fopen("file.csv","r"))!==FALSE){
while(($data = fgetcsv($handle,1000,","))!==FALSE){
$lead = array();
if($row==1){
$csvhead = $data;
} else {
foreach($csvhead as $heading) {
$lead[$heading] = $data[array_search($heading,$csvhead)];
}
$leads[] = $lead;
}
$row++;
}
fclose($handle);
}
then access the array like this
foreach($leads as $lead){
echo $lead["header name"];
}
精彩评论