Bonjour,

J'ai un petit problème que j'ai de la peine à expliquer, j'ai mis à jour mes scripts, ils fonctionnent très bien avec WAMP, je les ai mis sur mon site, la plupart fonctionnent, sauf certains, et curieusement ce sont plusieurs scripts que j'utilise pour imprimer.

Un exemple d'un qui fonctionne sur WAMP et sur mon site :

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
 
// On inclut la connexion à la base
include('include/db_inc_pdo.php');
$id = isset($_POST['truc']) ? $_POST['truc'] : '';
$id = $_POST['truc'];
// On écrit notre requête
$sql = "SELECT 
nom, prenom, noma, rue, cp, ville, pays, civilites.civil
FROM `locataires` INNER JOIN civilites on locataires.idcivil = civilites.idcivil WHERE idnoms = '" . $id . "'";
 
// On prépare la requête
$query = $pdo->prepare($sql);
 
// On exécute la requête
$query->execute();
 
// On stocke le résultat dans un tableau associatif
$result = $query->fetchAll(PDO::FETCH_ASSOC);
 
?>
 
 
<link rel="stylesheet" href="print.css" type="text/css">
 
<style>
div {
	padding-top: 150px;	
  padding-left: 400px;
  font-size: 18px;
}
table {
  border-collapse: collapse;
  border: 1px solid black;
 font-size: 18px; 
} 
 
th,td {
 border: 1px solid black; 
 padding: 10px;
}
table.a {
  table-layout: auto;
  width: 180px;  
}
 
table.b {
  table-layout: fixed;
  width: 180px;  
}
 
table.c {
  table-layout: auto;
  width: 100%; 
font-size: 14px;  
}
 
table.d {
  table-layout: fixed;
  width: 100%;  
}
 
</style>
 
 
<!DOCTYPE html>
<html lang="fr">
<head>
 
 
</head>
<body>
 
 
    <table>
 
        <tbody>
        <?php
            foreach($result as $adloc){
        ?>
 
 
 
 
 <tr>
 
               <div>
					<p>
					<?= $adloc['civil'] ?>&nbsp;&nbsp;<?= $adloc['prenom'] ?>&nbsp;&nbsp;<?= $adloc['nom'] ?>&nbsp;&nbsp;<?= $adloc['noma'] ?>
					<br>
					<?= $adloc['rue'] ?>
					<br>
					<?= $adloc['cp'] ?>&nbsp;<?= $adloc['ville'] ?>
					<br>
 
					<?php if($adloc['pays'] !== 'Suisse'): ?>
					<?= $adloc['pays'] ?>
					<?php endif; ?>
 
					</p>				
 
				</div>		
 
</tr>
 
<?php
      }
?>
        </tbody>
    </table>
 
</body>
</html>
et un de ceux qui fonctionne sur WAMP mais pas sur mon site :

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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
// On inclut la connexion à la base
include('db_inc_pdo.php');
 
$d = isset($_POST['deb']) ? $_POST['deb'] : '';
$d = $_POST['deb'];
echo '<br /><center><font color="blue"><big><b>Debut: ' . $d . '</b></center></font></big>'; //nombre de résultats
 
$f = isset($_POST['fin']) ? $_POST['fin'] : '';
$f = $_POST['fin'];
echo '<br /><center><font color="blue"><big><b>Fin: ' . $f . '</b></center></font></big>'; //nombre de résultats
 
?>
<link rel="stylesheet" href="print.css" type="text/css">
<style type="text/css"></style>
	<script>
 
</script>
 
<table class="bicolor" border="1"  align="center">
        <tr>
            <th>Arrivée</th>
            <th>Départ</th>
			<th>Nb. jours</th>
			<th>Nom</th>
			<th>Prénom</th>
            <th>Prix Location</th>
            <th>Caution</th>
            <th>Lit bébé</th>
            <th>Linge</th>
            <th>Prix Total</th>																		
			<th>Somme payée</th>
            <th>Reste à payer</th>
			<th>Degâts payés</th>
			<th>Non payé</th>
			<th>Revenu</th>						
			<th>Caution restituée</th>
				</tr>
        <?php
 
 
 
$reponse = $pdo->query("SELECT 
DATE_FORMAT( datearrive, '%d/%m/%Y' ) AS datea, 
DATE_FORMAT( datearrive, '%Y' ) AS annee, 
DATE_FORMAT( datedepart, '%d/%m/%Y' ) AS dated, 
DATEDIFF(datedepart,datearrive ) AS datediff, 
dateloca.datearrive,
dateloca.datedepart, 
dateloca.nombre, 
dateloca.prixlocation, 
dateloca.caution, 
(dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby) as PT, 
(dateloca.apaiement+dateloca.bpaiement+dateloca.cpaiement) as Totalpaye, (dateloca.prixlocation+dateloca.caution+dateloca.linge+dateloca.litbaby-dateloca.apaiement-dateloca.bpaiement-dateloca.cpaiement) as Reste, (dateloca.apaiement+dateloca.bpaiement+dateloca.cpaiement-dateloca.caution) as Totalrevenu, 
dateloca.apaiement, 
DATE_FORMAT( dateapaiement, '%d/%m/%Y' ) AS dateunp, 
dateloca.bpaiement, DATE_FORMAT( datebpaiement, '%d/%m/%Y' ) AS datedeuxp, 
dateloca.cpaiement, 
DATE_FORMAT( datecpaiement, '%d/%m/%Y' ) AS datetroisp, 
dateloca.linge, 
dateloca.litbaby, 
dateloca.degatspayes, 
dateloca.nonpaye, 
dateloca.remarques, 
dateloca.restitution, 
DATE_FORMAT( datelettre, '%d/%m/%Y' ) AS datel, 
dateloca.appart, 
dateloca.envoitarifs, 
dateloca.envoidescriptif, 
dateloca.paragraphesup, 
dateloca.confirmation, 
dateloca.enfants, 
locataires.nom, 
locataires.prenom 
		 
				FROM dateloca
				
        INNER JOIN locataires ON  dateloca.idnoms = locataires.idnoms
				WHERE locataires.reserve = 'oui' 
				AND dateloca.annul =2 
				AND dateloca.prixlocation >0 
				AND dateloca.datearrive >'$d' 
				AND dateloca.datearrive <'$f'

ORDER BY datearrive DESC ");
 
 
while ($donnees = $reponse->fetch())
{
 
	 //On affiche les données dans le tableau
    echo "<tr>";
    echo "<td> $donnees[datea] </td>";
    echo "<td> $donnees[dated] </td>";
	echo "<td align=right> $donnees[datediff] </td>";
 
    echo "<td> $donnees[nom] </td>";
	echo "<td> $donnees[prenom] </td>";
	echo "<td align=right> $donnees[prixlocation] </td>";
	echo "<td align=right> $donnees[caution] </td>";
	echo "<td align=right> $donnees[linge] </td>";
	echo "<td align=right> $donnees[litbaby] </td>";	
	echo "<td align=right> $donnees[PT] </td>";
	echo "<td align=right> $donnees[Totalpaye] </td>";
	echo "<td align=right> $donnees[Reste] </td>";
	echo "<td align=right> $donnees[degatspayes] </td>";
	echo "<td align=right> $donnees[nonpaye] </td>";
	echo "<td align=right> $donnees[Totalrevenu] </td>";
	echo "<td> $donnees[restitution] </td>";
 
	echo  "</td>";
    echo  "</tr>";
 
}			
 
 
$arrAll = $reponse->fetch(PDO::FETCH_ASSOC);
 
?>
<br />
<?php
 
{
 
echo $reponse->rowCount() . ' résultat(s)';
}
?>
<br />
<?php 
 
$reponse->closeCursor();
?>
Je trouve cela vraiment bizarre !!! Il ne me semble pas qu'il y ait d'erreur !!! Avez-vous une idée pourquoi cela fonctionne d'un côté et pas de l'autre ?

Merci d'avance si vous pouvez éclairer ma lanterne.