I wrote this small script to populate a db, but it only inserts the last member of the $datafile.
Please take a look at it.
Thanks
<head>
<title>INSERT</title>
</head>
<body>
<?PHP
//dados basicos
$DBhost = "local";
$DBuser = "ca";
$DBpass = "5";
$DBName = "photolist";
$table = "pictures";
$data_file = "list.txt";
$lista = file($data_file);
$total_lista=sizeof($lista);
echo($total_lista);
//conexao
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db($DBName) or die("Unable to select
database $DBName");
$i = 0;
while ($i <= $total_lista) {
//atualiza db
$sql = "INSERT INTO pictures SET LocalizacaoImagem='$lista[$i]'";
echo($lista[$i]);
$i++;
}
if (@($sql)) {
echo("<p>New pictures added</p>");
} else {
echo("<p>Error adding new pictures: " .
mysql_error() . "</p>");
}
?>
</body>