这个php代码,$sql=$p=""这句是什么意思?
<?php$fp=fopen("a.csv","r");while(!feof($fp)){$data=fgetcsv($fp);if(!is_array($data))...
<?php
$fp=fopen("a.csv","r");
while(! feof($fp)){
$data=fgetcsv($fp);
if(!is_array($data))
continue;
$sql=$p="";
foreach($data as $val){
$sql.=$p."'".$val."'";
$p=",";
}
$sql="insert into tab values(".$sql.")";
echo $sql;
//mysql_query($sql,$mylink);
}
fclose($fp);
?> 展开
$fp=fopen("a.csv","r");
while(! feof($fp)){
$data=fgetcsv($fp);
if(!is_array($data))
continue;
$sql=$p="";
foreach($data as $val){
$sql.=$p."'".$val."'";
$p=",";
}
$sql="insert into tab values(".$sql.")";
echo $sql;
//mysql_query($sql,$mylink);
}
fclose($fp);
?> 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询