Bonjour,

Voici mon soucis, j'ai une page dans laquelle je charge au démarrage un tableau via AJAX. J'utilise donc un fichier PHP annexe dans lequel je fais ma requête et je construit mon tableau. La partie ajax est simplement un $(div).load(file.php). Et lorsque je charge ma page, les données se retrouvent au dessus des entêtes du tableau, c'est bizarre et je n'arrive pas à voir ce qui cloche

Voici mon code PHP :

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
 
function display($string){
    echo htmlentities($string,ENT_QUOTES,'ISO-8859-1');
}
include '../verif.php';
include '../condb.php';
$code = $_SESSION['code'];
$sql=mysql_query("SELECT * FROM commandes WHERE Code='".$code."'");
echo "<table>";
echo "<tr>";
echo "<th>Ref.</th>";
echo "<th>Désignation</th>";
echo "<th>Prix</th>";
echo "<th>Quantité</th>";
echo "</tr>";
while($data=mysql_fetch_array($sql)){
    echo "<tr>";
    echo "<td>".display($data['Reference'])."</td>";
    echo "<td>".display($data['Designation'])."</td>";
    echo "<td>".display($data['Prix'])."</td>";
    echo "<td>".display($data['Quantite'])."</td>";
    echo "</tr>";
    echo "<br>";
}
/*echo "</tbody>";*/
echo "</table>";
Merci d'avance pour votre aide