I've run into a peculiar problem with a section of my code (below). I
want to be able to show the number of documents associated with each
result. It works fine for the cases "Name" and "Title". The default
"Subject" simply won't compute the number of documents therefore the
hyperlink won't work. It doesn't just come up with 0 it comes up with
empty query (error 1065). I've moved the cases around to see if that
worked but it didn't. And the rest of the code works fine. For example,
for the subject case it does list the results, just not the number of
documents. The three cases are identically set up. Each is accessing
the same table although each is coming from different tables. Is it
just some little error I'm missing?
while ($row = @ mysql_fetch_array($result))
{
print "<p>\n<table>\n\t<tr>\n\t\t<td class='left'>";
switch ($Type)
{
case "Name":
$documents = mysql_query("Select COUNT(*) FROM INCM WHERE
CompControl1 = {$row ["Control"]} or CompControl2 = {$row ["Control"]}
or ArrControl1 = {$row ["Control"]} or ArrControl2 = {$row ["Control"]}
or AuthControl1 = {$row ["Control"]} or AuthControl2 = {$row
["Control"]}");
if (mysql_result($documents, 0) > 0)
{
print "<a
href=\"INCMResults2.php?fieldname=Names&inquiry={$row["Control"]}\"
target=\"body\">";
print "{$row ["Authority"]} ";
if ($row [Initials] != '')
print "({$row
["Initials"]}) ";
print "({$row
["Birth"]}-{$row ["Death"]})</a>";
}
else {
print "{$row ["Authority"]} ";
if ($row ["Initials"]
!= '')
print "({$row
["Initials"]}) ";
print "({$row
["Birth"]}-{$row ["Death"]})";
}
print " -- " . mysql_result($documents, 0) . "
Document(s)\n";
break;
case "Title":
$documents = mysql_query("Select COUNT(*) FROM INCM WHERE
TitleControl = {$row ["Control"]} or Title2Control = {$row ["Control"]}
or FirstLineCon1 = {$row ["Control"]} or FIrstLineCon2 = {$row
["Control"]} or ChorusCon1 = {$row ["Control"]} or ChorusCon2 = {$row
["Control"]} or SeriesControl = {$row ["Control"]} or SeriesControl2 =
{$row ["Control"]}");
if (mysql_result($documents, 0) > 0)
{
print "<a
href=\"INCMResults2.php?fieldname=Titles&
inquiry={$row["Control"]}\" target=\"body\">";
print "{$row
["Authority"]}</a>";
}
else
{
print "{$row ["Authority"]}";
}
print " -- " . mysql_result($documents, 0) . "
Document(s)";
break;
default:
$documents = mysql_query("Select COUNT(*) FROM INCM WHERE
SubjControl1 = {$row ["Control"]} or SubjControl2 = {$row ["Control"]}
or SubjControl3 = {$row ["Control"]} or SubjControl4 = {$row
["Control"]} or SubjControl5 = {$row ["Control"]} or SubjControl6 =
{$row ["Control"]}");
if (mysql_result($documents, 0) > 0)
{
print "<a
href=\"INCMResults2.php?fieldname=Subjects&inquiry={$row
["Control"]}\" target=\"body\">";
print "{$row ["Combined"]}</a>";
}
else
{
print "{$row ["Combined"]}";
}
print " -- " . mysql_result($documents, 0) . "
Document(s)\n";
break;
}
print "\n\t\t</td>\n\t</tr>\n</table><p>";
}
Clifford Ford
[Non-text portions of this message have been removed]