<?php
$username='miguelde_modulo4';
$password='modulo4';
$dbname='miguelde_modulo4';
$host='localhost';
echo'
<html>
<h3> BANCO DE DADOS LEITURA MAC MARIANA E EDUARDO AFONSO </h3>
<table border=2>
<tr>
<td>IdLeitura</td>
<td>Placa MAC</td>
<td>Nome Placa</td>
<td>Dataleitura</td>
<td>Horaleitura</td>
<td>Valor</td>
<td>VelocidadeLeitura</td>
<td>AAAAAAAAAAAAAAAAAAAA</td>
</tr>

</html>';
try {
 $conn = new PDO("mysql:host=$host;dbname=$dbname", $username, $password);
 $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
 $sql='SELECT leitura.idleitura,
 leitura.mac_idmac,
 mac.nome,
 leitura.dataleitura,
 leitura.horaleitura,
 leitura.valor
 from leitura,mac
 where leitura.mac_idmac = mac.idmac
 
';
 $data = $conn->query($sql);
 foreach($data as $row) {
 echo'<td>'.($row[0]).'</td>';
 echo'<td>'.($row[1]).'</td>';
 echo'<td>'.($row[2]).'</td>';
 echo'<td>'.($row[3]).'</td>';
 echo'<td>'.($row[4]).'</td>';
 echo'<td>'.($row[5]).'</td>';
 echo'<td>'.($row[6]).'</td>';
 echo'<td>'.($row[7]).'</td><tr></tr>';
 }echo '</table>';
} catch(PDOException $e) {
 echo 'ERROR: ' . $e->getMessage();
}
?>