Bonjour,

J'ai écris le code suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
<?php
header ( "Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header ("Pragma: no-cache");
 
$mydate1 = new DateTime(isset($_REQUEST["date3"]) ? $_REQUEST["date3"] : "");
$mydate2 = new DateTime(isset($_REQUEST["date4"]) ? $_REQUEST["date4"] : "");
$Routeur = mysql_real_escape_string($_POST['Rout']);
$Serial = mysql_real_escape_string($_POST['Ser']);
$RoutInt=mysql_real_escape_string($_POST['Rout'] . $_POST['Ser']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<link rel="stylesheet" href="style.css" />
<title>Traitement des logs</title>
<meta http-equiv="Content-Type" content="text/html;
charset=utf8" />
<img src="rte.gif" height=140 width=225>
<?php include("condbarchive.php"); ?>
</head>
<body>
<?php include("menu2.php"); ?>
</br>
 
<?php
 
// Requête SQL : NEttoyage de la base archive
$reqnet = 'TRUNCATE `log_caa`;
TRUNCATE `log_caa_dec`;
TRUNCATE `log_routteb_dec1`;
TRUNCATE `log_routteb_dec1` ;
TRUNCATE `log_routteb_dec2` ;
TRUNCATE `log_routteb_dec3` ;
TRUNCATE `log_rout_liaison` ;
TRUNCATE `log_rout_liai_dec` ;
TRUNCATE `log_rout_teb` ;
TRUNCATE `result_log_caa` ;
TRUNCATE `result_log_rout` ;
TRUNCATE `result_log_teb` ;
TRUNCATE `routeur_teb` ;
TRUNCATE `rout_interface` ;
TRUNCATE `reboot_rout` ;
TRUNCATE `deret` ;
TRUNCATE `DerEt2` ;
TRUNCATE `Logs_Arch` ;
TRUNCATE `Logs_Arch_dec` ;' ;
 
// Execution de la requête
$reqs = explode(';',$reqnet); // on sépare les requêtes
foreach($reqs as $req){	// et on les éxécute
	if (!mysql_query($req,$linka) && trim($req)!=""){
		die("ERROR : ".$req); // stop si erreur 
	}
}
mysql_close($linka);
foreach(new DatePeriod($mydate1, new DateInterval('P1D'), $mydate2) as $d) {
$dtemp = mysql_real_escape_string($d->format('d-m-20y')) ;
include("condbarchive.php"); 	
	// Requête SQL
	$seltemp = 'LOAD DATA INFILE \'D:/Archives_LOGS_ORS/LOGS_ORS'.$dtemp.'.txt\' INTO TABLE Logs_Arch FIELDS TERMINATED BY \'	\' LINES STARTING BY \'\' TERMINATED BY \'\n\' ' ;
	// Execution de la requête
	mysql_query($seltemp,$linka) or die ('Erreur : '.mysql_error() );
mysql_close($linka);	
}
?>
Mais la boucle for ne fonctionne que pour la première valeur.
La requête SQL n'est exécutée que pour la première valeur de $dtemp.

Merci de votre aide.