<?php

$db = mysql_connect("mysql102.mysite4now.com", "kevin", "razorpeppe");
mysql_select_db("UPC",$db);
$result = mysql_query("SELECT * FROM comment where page='$filename' order by timestamp",$db);

if (mysql_num_rows($result) > 0) {

	echo '<p style="text-align:center; font-size:small"><b>Comments:</b></p>';

	while ($myrow = mysql_fetch_row($result)) {

		$name = $myrow[1];
		$website = $myrow[3];
		$comment = $myrow[4];
		$order   = array("\r\n", "\n", "\r");
		$replace = '<br />';
		$comment = str_replace($order, $replace, $comment);
		$timestamp = $myrow[5];
		$timestamp = explode(' ', $timestamp);
		$timestamp2 = explode(':', $timestamp[1]);

		echo '<div ID="comment">';
		echo '<p style="font-size:small; text-align:left">';
		echo $comment;
		echo '</p>';

		echo '<p style="font-size:small; text-align:center">';
		echo 'Posted by: ';

		if ($website!="")
			echo '<a href="',$website,'">',$name,'</a>';
		else
			echo $name;

		echo ' | ';
		echo '<i>';
		echo $timestamp[0], " ", $timestamp2[0] + 1, ":", $timestamp2[1], ":", $timestamp2[2];
		echo '</i>';
		echo '</p>';
		echo '</div>';

		echo '<br />';

	}
}

?>
