@mysql_select_db("cookiethievery") or die("Unable to select database"); if(!isset($_GET['p'])){ $p = 1; } else { $p = $_GET['p']; } $max_results = 10; $from = (($p * $max_results) - $max_results); if ((isset($_GET['n'])) && (is_numeric($_GET['n']))) { $sql="SELECT *,DATE_FORMAT(datetime, '%m.%d.%y') AS date, DATE_FORMAT(datetime, '%H:%i') AS time FROM gbook WHERE id = '$n'"; } else if (isset($_GET['name'])) { $sql="SELECT *,DATE_FORMAT(datetime, '%m.%d.%y') AS date, DATE_FORMAT(datetime, '%H:%i') AS time FROM gbook WHERE name = '$name' ORDER BY id ASC"; } else { $sql="SELECT *,DATE_FORMAT(datetime, '%m.%d.%y') AS date, DATE_FORMAT(datetime, '%H:%i') AS time FROM gbook ORDER BY id DESC LIMIT $from, $max_results"; } $result=mysql_query($sql,$db); $num = mysql_num_rows($result); $cur = 1;