数据库,php pdo和html

I have been going over the same scenario several times but It just wont work for me regardless of what I do. What I am trying to do is update my website content straight from my database. I have tables that correspond to my tables in my webpage and I want to simply outut the results.

This is how It looks right nw

<?php
$file = dirname(__FILE__) . "/db.sqlite";
$db = new PDO("sqlite:$file");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
?>

<div class="featured">
<h3>Featured</h3>
<?php
if(!$res)
echo"No Content Available Yet..";
else  
echo "<table>";
foreach($res AS $val) {
 echo "<tr>";
 foreach($val AS $val1) {
echo "<td>$val1</td>";
 }
echo "</tr>";
}
echo "</table>";
$db = null;
?>
</div>

**This works fine for one piece of content but when I want to use the same code for my next column, it stops working.

*So in other words when I try to retreive data from another table, I dont know how to do it. *