テーブルからデータを引っ張てきます。
<?php elseif($_GET["path"] == 'sentitems'): ?>
<h2>Sent Items</h2>
<?php
$dsn = "mysql:dbname=mail;host=localhost";
$user = "hoge";
$password = "hogehoge";
$username = $_SESSION["username"];
try {
$dbh2 = new PDO($dsn, $user, $password);
} catch (PDOException $e){
print('connection failed:'.$e->getMessage());
}
$sql2 = "select * from sends where username = '".$username."'";
$stmt2 = $dbh2->query($sql2);
while($result = $stmt2->fetch(PDO::FETCH_ASSOC)){
$id[] = $result['id'];
$destination[] = $result['destination'];
$subject[] = $result['subject'];
$sendtime[] = $result['sendtime'];
}
$i= 0;
echo "<table>";
foreach($destination as $value){
echo "<tr><td> <img src=\"icon.png\"> <a href=\"\">".$value ."</a></td><td><a href=\"\">". $subject[$i]."</a> </td><td>" .$sendtime[$i]. " </td></tr>";
$i++;
}
echo "</table>";
?>
<?php endif; ?>

アイコンをつけてそれっぽくします。

idで、メール詳細に移動するようにします。
あああ、なるほど、gmailはメール詳細に飛ぶ際に、乱数字16桁のid使ってますね。
なるほどな~!
