1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <?php
include('connection.php');
ini_set("memory_limit", "12000M"); // augmentation memoire
set_time_limit(0); // illimite dans le temps exé du script
$req = mysql_query("TRUNCATE TABLE towns");
$datafile = file('towns.txt'); // absortion des données
if(!is_array($datafile)) die("File could not be opened");
foreach($datafile as $datum){
list($id, $player_id, $name, $island_x, $island_y, $number_on_island, $point) = explode(',', $datum);
include ('connection.php');
$sql = "INSERT INTO towns (id, player_id, name, island_x, island_y, number_on_island, point) VALUES('$id', '$player_id', '$name', '$island_x', '$island_y','$number_on_island','$point')";
mysql_query($sql) or die('la base island n\'a pas ete mise a jour '.mysql_error());
}echo 'La table towns a ete mise à jour:'; |
Partager