Hello all, its been awhile now hasnt it? Anyways, I need some help with the following code. Its purpose is for an archive script for php scripts. The following is just some info you need to know.
----===The Catagories in the MySQl database===----
Database
File/Directory
Games
General
Graphics
HTTP
Misc.
Network
Time/Date
----===Some info===----
functions_new.inc is included in the following pages (archive.php). The only information called from functions_new.inc is the variables to connect to the MySQL database, like Username, Password, that kinda stuff.
----===archive.php===----
<?
include_once("functions_new.inc");
if(isset($topic) && !empty($topic))
{
$link = mysql_connect($host, $username, $password);
if(!$link)
die("Error in MySQL database. Archive List can not be shown.");
mysql_select_db($database, $link)
or die("Couldn't open up the database:".mysql_error());
$result = mysql_query("SELECT LID,topic,author,author_email,body,link,title FROM archive_list
WHERE topic=$topic ORDER BY LID DESC");
$num_rows1 = mysql_num_rows($result);
//this is for next/prev links.
//If there are 10 records in the Database,
//it will have the next/prev links.
$max_records=10;
$tot_pages=ceil($num_rows1/$max_records);
if($num_rows1>$max_records)
{
if (empty($page))
{
$page=1;
}
$start_rec=($page-1)*$max_records+1;
$end_rec=$page*$max_records;
if ($page == 1)
{
$prev_page = 1;
}
else
{
$prev_page = $page-1;
}
if($page == $tot_pages)
{
$next_page = $page;
}
else
{
$next_page = $page + 1;
}//end of next/prev links
while($list = mysql_fetch_array($result))
{ //some more for the next/prev links
$count++;
if($count>=$start_rec && $count<=$end_rec)
{
//prints the actual archive content
print "$list[title]<br>
<a href=\"$list[link]\">Download Now<a><p>";
}
}
}
if ($num_rows1<1)
{
print "There are no scripts for this catagory.";
}
if ($num_rows1>$max_records)
{
print "<p><a href=\"?page=$prev_page\">< Previous 10</a>";
}
}
else
{
//this shows the catagories
$link = mysql_connect($host, $username, $password);
if(!$link)
die("Error in MySQL database. Archive List can not be shown.");
mysql_select_db($database, $link)
or die("Couldn't open up the database:".mysql_error());
$result = mysql_query("SELECT AID,topic FROM archive_topics ORDER BY topic");
$num_rows2 = mysql_num_rows($result);
while($topic = mysql_fetch_array($result))
{
print "<a href=\"?page=archive&topic=$topic[AID]\">$topic[topic]</a><br>";
}
if ($num_rows2<1)
{
print "<font size=\"2\">There are no Catagories.</font>";
}
}
?>
----===Problem===----
The code above will not print out any of the content when you click on the catagory. It will just be blank. I need someone to look over the code for me to see if I missed anything. Thanx to all that try (or actually) to help.