Undefined variable: sql in D:\phpStudy\php53\1.php on line 16
<?php$link=mysql_connect("localhost","root","root")ordie(mysql_error());mysql_select_...
<?php
$link = mysql_connect("localhost","root","root") or die (mysql_error());
mysql_select_db('ku',$link)or die (mysql_error());
mysql_query("set names utf8");
$file = file('1001.txt');
$d = $c =count($file);
$a = 100;
$sql2 = "INSERT INTO '100' ('id','username','password')VALUES";
foreach($file as $k=>$value){
//$data = preg_split("/\s+/",$value);
$data=explode(',',$value);
$username = trim($data[0]);
$password = trim($data[1]);
//$email = trim($data[2]);
//$key = trim($data[3]);
$sql.=",(null,'$username','$password')";
if($k>$a && $k<$c){
$sql=str_replace("VALUES,","VALUES",$sql2.$sql);
if(mysql_query($sql)){
$dd=$d-=100;
echo $dd."\n";
}
unset($sql);
$a+=100;
}
}
?> 展开
$link = mysql_connect("localhost","root","root") or die (mysql_error());
mysql_select_db('ku',$link)or die (mysql_error());
mysql_query("set names utf8");
$file = file('1001.txt');
$d = $c =count($file);
$a = 100;
$sql2 = "INSERT INTO '100' ('id','username','password')VALUES";
foreach($file as $k=>$value){
//$data = preg_split("/\s+/",$value);
$data=explode(',',$value);
$username = trim($data[0]);
$password = trim($data[1]);
//$email = trim($data[2]);
//$key = trim($data[3]);
$sql.=",(null,'$username','$password')";
if($k>$a && $k<$c){
$sql=str_replace("VALUES,","VALUES",$sql2.$sql);
if(mysql_query($sql)){
$dd=$d-=100;
echo $dd."\n";
}
unset($sql);
$a+=100;
}
}
?> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询