<?
session_start();
$hostname = 'localhost';
$username = 'mmaaaco_ksecor';
$password = 'hamilton';
$dbh = new PDO("mysql:host=$hostname;dbname=mmaaaco_ksecor", $username, $password);

?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<?
/*
CREATE TABLE IF NOT EXISTS `3304_posts` (
  `id` int(5) NOT NULL auto_increment,
  `title` varchar(255) NOT NULL,
  `post` text NOT NULL,
  `catid` int(5) NOT NULL,
  `userid` int(5) NOT NULL,
  PRIMARY KEY  (`id`)
)  ;
CREATE TABLE IF NOT EXISTS `3304_forumcats` (
  `catid` int(5) NOT NULL auto_nicrement,
  `catname` varchar(255) NOT NULL,
  `catdesc` text NOT NULL,
  PRIMARY KEY  (`catid`)
) 
*/
?>
<title>Forum</title>
</head>
<body>
<?
echo 'Welcome, '. $_SESSION['fname'];

include 'search.php';
$catsql = $dbh->prepare("select catid,catname from 3304_forumcats");
$catsql->execute();
while ($catrow = $catsql->fetch()){
$catid = $catrow[0];
$catname = $catrow[1];
echo '<a href = "posts.php?catid='.$catid.'">'.$catname.'</a><br/>';
}

?>

</body>
</html>
