1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| $sql= "SELECT * FROM gghf_rando WHERE sid > '$datesync'";
$resultats1 = mysql_query($sql, $connexion2);
// On boucle sur toute la table
$data = array();
while ($row = mysql_fetch_assoc($resultats1))
{
// on échappe les données
$clean = array_map('mysql_real_escape_string', $row);
$data[] = <<<SQL
({$clean['no']}, {$clean['annee']}, {$clean['rando']}, {$clean['id']},
{$clean['nom']}, {$clean['prenom']}, {$clean['rue']}, {$clean['code']},
{$clean['postal']}, {$clean['newid']}, {$clean['tombola']})
SQL;
}
$sql2 = 'INSERT INTO gghf_rando (no, annee, rando, id, nom, prenom, rue, code, postal, newid, tombola) VALUES '.implode(', ', $data);
$resultats2 = mysql_query($sql2, $connexion1); |
Partager