I have my categories directly inside the one news table, like this:
CODE
CREATE TABLE `php_news` (
`id` int(20) NOT NULL auto_increment,
`timestamp` int(20) NOT NULL default '0',
`title` varchar(255) NOT NULL default '',
`category` varchar(255) NOT NULL default '',
`entry` longtext NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=502;
--
-- Daten für Tabelle `php_news`
--
INSERT INTO `php_news` VALUES (1, 1150532220, 'Teen Choice nominees announced', 'awards', 'blabla);
And I have it just like this (the category name comes from the things you put in):
CODE
<?php } elseif (substr_count($_SERVER['QUERY_STRING'], 'category')) { ?>
<?php
if ($_GET["c"]) {
$c=clean($_GET['c']);
echo "<h1>$c</h1>";
$result = mysql_query("SELECT * FROM php_news WHERE category='$c' ORDER BY timestamp DESC") or
print ("Can't select entries from table news.<br />" . $result . "<br />" . mysql_error());
while ($row = mysql_fetch_array($result)) {
$id = $row["id"];
$date = date("F d, Y, g:i a",$row["timestamp"]);
$title = $row["title"];
$category = $row["category"];
echo "<p><div style=\"float:left;display:inline;clear:both\">$date</div><div style=\"margin-left:180px;\"> Ι <a href=\"?entry&id=$id\">$title</a></div></p>";
}
} else {
$result = mysql_query("SELECT category AS get_group FROM php_news GROUP BY get_group ASC") or print ("Can't select categories.<br />" . $result . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
$category = $row["get_group"];
echo "<a href=\"?category&c=$category\">$category</a><br />";
}
}
?>
It was when I had no clue at all with php.
If that doesn't help, you should post the code you already have and how your database is created.
Instead of my <h1>$c</h1> you can just put your words in.