http://www.didymus.org.uk/new/tree/disp ... ?urn=11164 if anybody wants to see what I've done so far!
My MySQL database stores the filenames of photographs of individuals. What I WANT to do is modify my search engine code so that it counts the number of photographs for each person and returns the count in a column.
i.e.
I've come up with the following code but there SURELY must be a more efficient way of running the enquiry. For your info, the database either stores the word blank or the first part of the filename (minus the .gif suffix).URN SURNAME FORENAME(S) PHOTOGRAPHS ....
11164 Didymus Kristian Paul 5
Code: Select all
if ($photo1urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
if ($photo2urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
if ($photo3urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
if ($photo4urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
if ($photo5urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
if ($photo6urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
if ($photo7urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
if ($photo8urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
if ($photo9urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
if ($photo10urn != "blank")
{ $pc1 = "1";}
else
{$pc1 = "0";}
$photocount = $pc1 + $pc2 + $pc3 + $pc4 + $pc5 +$pc6 +$pc7 +$pc8 +$pc9 +$pc10;
Many thanks in advance.
KD.