1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| <?php
//variables de connexion ?a base
//$host="localhost";
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'intrade';
mysql_select_db($dbname);
$query = mysql_query("SELECT DISTINCT agcepo FROM structure ORDER by agcepo") or die (mysql_error());
while($array = mysql_fetch_assoc($query)){
$po=$array['agcepo'];
$query1 = mysql_query("SELECT DISTINCT libelle, po FROM mails WHERE po='$po' ORDER by po") or die (mysql_error());
while($array1 = mysql_fetch_assoc($query1)){
print $array1['po']." - ";
print $array1['libelle'];
echo ";";
echo "<br>";
$departement_file = fopen("mails_".$po.".txt", "w");
fputs($departement_file,$array1['libelle'].";");
}
}
?> |
Partager