rendered paste body<?
if (!@mysql_select_db("mtlc?old")) {
echo 'Unable to locate the ' . 'database.';
}
if(isset($_POST['commenttext'])) {
$commenttext = $_POST['commenttext'];
$name = $_POST['name'];
$email = $_POST['email'];
$sql = "INSERT INTO comments SET
commenttext ='$commenttext',
commentdate =NOW(),
name ='$name',
email='$email'";
if (!@mysql_query($sql)) {
echo 'Error adding query: ' . mysql_error();
}
}
echo 'The comments listed in the database...<br>';
$result = @mysql_query('SELECT commenttext, commentdate, name, email FROM comments');
if (!$result) {
echo 'Error performing query: ' . mysql_error();
}
?>
</div>
<div id="comments">
<?
echo '<table>';
$tr=1;
while ($row = mysql_fetch_array($result)) {
echo '<tr class="tr' . $tr . '"><td>' . $row["name"] . ' says: <br>' . $row['commentdate'] . '<br>' . $row['commenttext'] . '</td></tr>';
if($tr==1){
$tr=2;
}
else if($tr==2){
$tr=1;
}
}
echo '</table>';
echo '<br>';
echo '<a href="' . $_SERVER['PHP_SELF'] . '?addcomment=1">Add comment!</a>';
?>
<?
$names = array("hello","hello","hello","hello","hello","hello","hello","hello","hello","hello","hello","hello","hello","hello",);
$page = $_GET['page'];
$pagedResults = new Paginated($names, 10, $page);
echo "<ul>";
while($row = $pagedResults->fetchPagedRow()) {
echo "<li>{$row}</li>";
}
echo "</ul>";
$pagedResults->setLayout(new DoubleBarLayout());
echo $pagedResults->fetchPagedNavigation();
?>