Example #1
0
?>
<div class="output">
<?php 
if ($quotes) {
    foreach ($quotes as $quote) {
        echo "<p class='quote'>\"" . nl2br($quote['quote']) . "\"<br /><br /><p class='prof'>" . $quote['prof'] . ", " . $quote['course'];
        if (!$search['ty']) {
            echo " (" . $quote['term'] . " " . $quote['year'] . ")";
        }
        echo "</p></p><br />\n";
    }
    unset($quotes);
} else {
    if ($_POST['submit'] && !$quotes) {
        echo "<p>No results for that search!</p>";
    } else {
        // Random quote!
        echo "<h2>A random quote...</h2>";
        $quote = $Q->randomQuote();
        if ($quote) {
            echo "<p class='quote'>\"" . nl2br($quote['quote']) . "\"<br /><br /><p class='prof'>" . $quote['prof'] . ", " . $quote['course'] . " (" . $quote['term'] . " " . $quote['year'] . ")</p></p>";
        } else {
            echo "<p>No quote for you!</p>";
        }
    }
}
?>
</div>
<?php 
$Q->disconnect();
include 'footer.php';