Afficher résultats de plusieurs tables sur même page
Bonjour,
Je souhaiterai afficher sur une même page le résultat de plusieurs tables.
Mon code est le suivant :
Code:
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
| <?php
$host = 'localhost:3306';
$dbname = 'xxxxxx';
$username = 'xxxxxb';
$password = 'xxxxx';
$date4 = date('d', strtotime($today));
$dsn = "mysql:host=$host;dbname=$dbname";
// récupérer tous les utilisateurs
$sql = "SELECT * FROM enginsjour WHERE jour = '$date4'";
$req = "SELECT * FROM verif WHERE date = '$date3'";
try{
$pdo = new PDO($dsn, $username, $password);
$stmt = $pdo->query($sql);
$pdo2 = new PDO($dsn, $username, $password);
$stmt2 = $pdo2->query($req);
if($stmt === false){
die("Erreur");
}
if($stmt2 === false){
die("Erreur");
}
}catch (PDOException $e){
echo $e->getMessage();
}
?>
<!DOCTYPE html>
<html>
<table>
<thead>
<tr>
</tr>
</thead>
<tbody>
<?php while($row = $stmt->fetch(PDO::FETCH_ASSOC)) : ?>
<tr>
<td><?php echo ' <font size="10px" color="black">'.$date4.'</font>';?></td>
</tr>
<td><?php echo htmlspecialchars($row['engin1']); ?></td>
<td><?php echo htmlspecialchars($row['matricule']); ?></td>
<td><?php echo htmlspecialchars($row['test1']); ?></td>
</tr>
</tr> <td><?php echo htmlspecialchars($row['engin2']); ?></td>
</tr>
<td><?php echo htmlspecialchars($row['engin3']); ?></td>
</tr>
<td><?php echo htmlspecialchars($row['engin4']); ?></td>
</tr> <td><?php echo htmlspecialchars($row['engin5']); ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</body>
</html> |
Le problème doit venir d'ici.
Code:
<?php while($row = $stmt->fetch(PDO::FETCH_ASSOC)) : ?>
Je veux faire deux boucles .
Quelqu'un aurait une idée ?
Merci d'avance
Sébastien