// contents.php
$link=mysql_connect("ntsrv001","fileindex","fileindex") or die ("Unable to connect to MYSQL Server");
mysql_select_db("afi",$link) or die ("Database not found");
$subjects = mysql_query ("select * from subject_tbl order by subject_no");
//$category = mysql_query ("select * from category_tbl where subject_no = '$srow[0]'");
function strip_zeros($value)
{
if ($value==0) {
$value="";
}
else if ($value<=9) {
$value = substr($value,2);
$value = "/$value";
}
else if ($value<=99) {
$value = substr($value,1);
$value = "/$value";
}
else {
$value = "/$value";
}
}
?>
include("afimenu.php");
?>
Login to add or update filing index
while ($srow=mysql_fetch_row($subjects)){
echo "
";
for($sno=0;$sno";
echo "";
echo " ";
echo "$srow[$sno] ";
echo "";
echo "";
}
echo "
";
$category = mysql_query ("select category_no, description from category_tbl where subject_no = '$srow[0]'");
echo "\n";
while ($crow=mysql_fetch_row($category)){
echo "";
for($cno=0;$cno";
echo "$crow[$cno]";
echo "";
}
echo "
";
// $files = mysql_query ("select concat(category_no, '/', file_no,' ',description) from file_tbl where category_no = '$crow[0]'");
$files = mysql_query ("select concat(category_no, '/', file_no), description from file_tbl where category_no = '$crow[0]'");
echo "\n";
while ($frow=mysql_fetch_row($files)){
list($a,$b,$c,$d)=split("/",$frow[0]);
strip_zeros(&$b);
strip_zeros(&$c);
strip_zeros(&$d);
$frow[0] = "$a$b$c$d";
echo "";
for($fno=0;$fno";
echo "$frow[$fno]";
echo "";
}
echo "
";
}
echo "";
}
}
echo "
";
echo "";
echo "";
echo "";
?>