samedi 19 avril 2014

Undefined Offset :1 and 2


Vote count:

0




I am using explode function to insert a text pipe delimited file in sql table .


The error is : Notice: Undefined offset: 1 Notice: Undefined offset: 2 Both on line 34 ie. $list=explode("|",$line); $sql="INSERT INTO tb (tb1,tb2,tb3) VALUES('$list[0]','$list[1]','$list[2]')"; Please help.



while (!feof($handler)) // Loop til end of file.
{
$line= fgets($handler); // Read a line
$list=explode("|",$line);
$sql="INSERT INTO tb (tb1,tb2,tb3) VALUES('$list[0]','$list[1]','$list[2]')";
$result= mysql_query($sql,$conn);

}


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire