Or should I be using a completely different code altogether?
CODE
<?php
mysql_connect ('localhost', '', '');
mysql_select_db ('');
if (!isset($_GET['category']) || !is_numeric($_GET['category'])) {
die("Invalid category specified.");
}
$id = (int)$_GET['category'];
$sql = "SELECT * FROM php_blog WHERE cat='$category' LIMIT 99";
$result = mysql_query($sql) or print ("Can't select entry from table php_blog.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
$date = date("d F Y", $row['timestamp']);
$title = stripslashes($row['title']);
$id = stripslashes($row['id']);
$summary = stripslashes($row['summary']);
$category = stripslashes($row['category']);
$entry = stripslashes($row['entry']);
?>
<a href="read.php?id=<?php echo $id; ?>"><?php echo $title; ?></a><p />
<?php echo $summary; ?><p />
Posted on <?php echo $date; ?> | In Category <a href="show.php?cat=<?php echo $category; ?>"><?php echo $category; ?></a><p />
<?php
}
?>
mysql_connect ('localhost', '', '');
mysql_select_db ('');
if (!isset($_GET['category']) || !is_numeric($_GET['category'])) {
die("Invalid category specified.");
}
$id = (int)$_GET['category'];
$sql = "SELECT * FROM php_blog WHERE cat='$category' LIMIT 99";
$result = mysql_query($sql) or print ("Can't select entry from table php_blog.<br />" . $sql . "<br />" . mysql_error());
while($row = mysql_fetch_array($result)) {
$date = date("d F Y", $row['timestamp']);
$title = stripslashes($row['title']);
$id = stripslashes($row['id']);
$summary = stripslashes($row['summary']);
$category = stripslashes($row['category']);
$entry = stripslashes($row['entry']);
?>
<a href="read.php?id=<?php echo $id; ?>"><?php echo $title; ?></a><p />
<?php echo $summary; ?><p />
Posted on <?php echo $date; ?> | In Category <a href="show.php?cat=<?php echo $category; ?>"><?php echo $category; ?></a><p />
<?php
}
?>