while ($row3 = pg_fetch_row($avg)) {
        echo "<tr><td>{$row3['0']}</td><td>{$row3['1']}</td><td>{$row3['2']}</td><td>{$row3['3']}</td><td>{$row3['4']}</td></tr>";
        echo "\n";
    }
    echo "</table>";
    ?>
          </div>
        </div>
      <!-- End restaurant Picture and Review Score -->
      </div>
           <hr/>
      <?php 
}
?>
</div>
<!-- End restaurant section -->
<!-- Begin Random Reviews -->
<div class='large-9 columns' role='content'>
  <?php 
while ($rev = pg_fetch_row($reviews)) {
    echo "\n    <article>\n      <div class='row'>\n        <div class='large-3 columns'>\n          <img src='" . pg_fetch_all(get_avatar_by_userid($rev[0]))[0]["avatar_url"] . "' />\n        </div>\n        <div class='large-9 columns'>\n          <h3><a href='restaurant.php?rID={$rev['0']}''>" . restaurant_name_based_on_id($rev[9]) . "</a></h3>\n          <h6>REVIEWED BY <a href='raterProfile.php?userid={$rev['0']}'>" . pg_fetch_all(get_username_by_userid($rev[0]))[0]["name"] . "</a> • <i class='foundicon-star'></i> <a href='raterProfile.php?userid={$rev['0']}'>" . pg_fetch_all(get_review_count_by_userid($rev[0]))[0]["count"] . " reviews</a></h6>\n              <p>" . substr($rev[7], 0, 140) . "...</p>\n              <a href='restaurant.php?rID={$rev['0']}''>Full Review</a> <br />\n              <p>Posted on " . $rev[1] . "</p> \n        </div>\n      </div>\n    </article>\n  ";
}
?>
</div>
 
  <!-- Footer -->
  <?php 
require 'templates/footer.php';
?>

" class="button tiny secondary">Add a Menu Item</a>
    </div>
    <div class="large-6 columns">
      <?php 
echo "<h3><small>Hours</small></h3>\n      <h4><small>Mon: &nbsp; {$hours['1']}</small></h4>\n      <h4><small>Tue: &nbsp; {$hours['2']}</small></h4>\n      <h4><small>Wed: &nbsp; {$hours['3']}</small></h4>\n      <h4><small>Thu: &nbsp; {$hours['4']}</small></h4>\n      <h4><small>Fri: &nbsp; {$hours['5']}</small></h4>\n      <h4><small>Sat: &nbsp; {$hours['6']}</small></h4>\n      <h4><small>Sun: &nbsp; {$hours['7']}</small></h4>\n      ";
?>
    </div>
  </div>
  <hr/>
  <h3>Reviews of <?php 
echo $row[1];
?>
</h3>
  <?php 
while ($rat = pg_fetch_row($rating)) {
    $reviewCount = pg_fetch_all(get_review_count_by_userid($rat[0]));
    $name = pg_fetch_all(get_username_by_userid($rat[0]));
    $avatar = pg_fetch_all(get_avatar_by_userid($rat[0]));
    echo "\n  <article>\n    <div class='row'>\n      <div class='large-3 columns'>\n        <img src='" . $avatar[0]["avatar_url"] . "' />\n      </div>\n      <div class='large-9 columns'>\n            <h4><small>REVIEWED BY <a href='raterProfile.php?userid={$rat['0']}'>" . $name[0]["name"] . "</a> • <i class='foundicon-idea'></i> <a href='raterProfile.php?userid={$rat['0']}'>" . $reviewCount[0]["count"] . " Reviews</a></small></h4>\n               <p>{$rat['7']}</p> <br /> \n               <p>Posted on {$rat['1']} <br /> Was this helpful?\n               <ul class='button-group'>\n              <li><a href='#' class='button tiny secondary'>Yes</a></li>\n              <li><a href='#' class='button tiny secondary'>No</a></li>\n            </ul></p> \n      </div>\n    </div>\n  </article>\n  <hr/>\n  ";
}
?>
</div>

<aside class="large-3 columns">
  <h3 style="text-align: center"><small>Nearby</small></h3>
<hr/>
<?php 
while ($near = pg_fetch_row($nearby)) {
    echo " <div class='row'>\n\n          <div class='large-6 columns'>\n          <h3><small><a href='restaurant.php?rID={$near['0']}'>{$near['1']}</a></small></h3>\n          <p><a href='http://{$near['3']}'><h5><small>{$near['3']}</small></h5></a></p>\n          </div>\n          <div class='large-6 columns'>\n            <img src='{$near['4']}' />\n          </div>\n        </div>\n        <hr/>";
}
?>