Hello,
Now that I have my script working, something else goes wrong! I have the script below, but it will only show the first record from the database pretaining to that category. I need it to display all the records pretaining to a specific category. Any help is appreciated.PHP Code:<?
include("/home/corby/phplib/pass.inc");
$db_name = "justforwebmasters_com";
$table_name = "Categories";
$pathstring = getenv("HTTP_HOST") == "justforwebmasters.com" ?
getenv("PATH_INFO") : $PHP_SELF ;
$id = $id;
// Allow Slash Marks Instead of Query Strings
$url_array = explode("/",$PATH_INFO);
$id=$url_array[1];
$db = mysql_select_db($db_name, $cnx) or die("Couldn't select database.");
// Select The Categories From the Categories Table
$sql = "SELECT ID, BigCat, Title, Description FROM $table_name";
$sql .= " WHERE ID =$id";
$result = mysql_query($sql, $cnx) or die("Couldn't execute query.");
while ($row = @mysql_fetch_array($result)) {
$ID = $row["ID"];
$BigCat = $row["BigCat"];
$Title = $row["Title"];
$Description = $row["Description"];
}
print "<html>\n";
print "<head>\n";
print " <title>JustForWebmasters > ".$BigCat." > ".$Title."</title>\n";
print "</head>\n";
include("http://www.justforwebmasters.com/includes/1.inc");
print "<a href=\"/".$BigCat.".php\" class=\"WhereYouAre\">".$BigCat." Your Site</a> > ".$Title."\n";
include("http://www.justforwebmasters.com/includes/2.inc");
print "<font class=\"Heading\">".$Title."</font><br><br>\n";
print "<font class=\"RegularText\">";
print "".$ID."<br>";
print "".$BigCat."<br>";
print "".$Title."<br>";
print "".$Description."<br>";
// Select Everything Pretaining to the Articles in the Content table
$sql = "SELECT ID, Title, Author_ID, Category_ID, Date, Visible, Description FROM Content";
$sql .= " WHERE Category_ID =$id";
$result = mysql_query($sql, $cnx) or die("Couldn't execute 2nd query.");
while ($row = @mysql_fetch_array($result)) {
$ID = $row["ID"];
$Title = $row["Title"];
$Author_ID = $row["Author_ID"];
$Category_ID = $row["Category_ID"];
$Description = $row["Description"];
print "".$ID."<br>";
print "".$Title."<br>";
print "".$Author_ID."<br>";
print "".$Category_ID."<br>";
print "".$Description."<br><br>";
$aid = "$Author_ID";
$ArtDesc = "$Description";
print "<a href=\"/article.php/".$ID."\"><b>".$Title."</b></a><br>\n";
// Select Everything Pretaining to the Authors
$authorsql = "SELECT ID, Name FROM Authors";
$authorsql .=" WHERE ID = $aid";
$result = mysql_query($authorsql, $cnx) or die("Couldn't execute 2nd query.");
while ($row = @mysql_fetch_array($result)) {
$ID = $row["ID"];
$Name = $row["Name"];
}
print "".$ID."<br>";
print "".$Name."<br><br>";
$aname = "$Name";
print "<font size=\"-2\">By: $aname</font><br>";
print "$ArtDesc";
print "<br><br>\n\n";
}
include("http://www.justforwebmasters.com/includes/3.inc");
?>






Bookmarks