Necesito ayuda con esto por favor:
Tengo un csv con un número por línea:
Código HTML:
8632995149 9122476118 2395438145 3868823577 2547323517
Intento así:
Código PHP:
require("con.php");
mysql_connect("$bd_host", "$bd_usuario", "$bd_password")or die("cannot connect");
mysql_select_db("$bd_base")or die("cannot select DB");
$q=mysql_query("delete FROM $table ");
$resulta=mysql_query($q);
// take a file and return an array seperated by each line
$names = file(numbers.csv);
// loop though array
for($i=0;$i<count($names);$i++){
// and add each entry to SQL
$sql = "INSERT INTO $table (id, home1) VALUES ('','$names[$i]')";
}
Qué estoy haciendo mal ?
Ayuda
