Ok... Here's the deal. I play a "SIM"ulated horse game that I'm a big part of, and I'm in charge of all the databases because I have the most experience with them. I've gotten everything working fine, but then I decided I wanted to try something new. In the game, your horse is awarded points for things, and there are "Titles" that they get when they achieve 100, 300, 500, 1000, etc. points. Since it takes 100 points to get a title, a lot of horses don't have one. What I want to do is say in my record "Horse has achieve Legandary Horse status on (Date they achieved it)" IF I have a title entered in the title field. If there ISN'T a title entered, I want it to say "Horse has not yet achieved any titles." or something. But everytime I do that, it comes up as having an internal error. So here's what I've got in my sub_html_record (I made bold the part that I'm talking about):
sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);
my $font_color = 'Font face="Arial" Size="1" Color=#000000';
my $font = 'Font face="Arial" Size="1"';
$url{'Owner'} = $rec{'Owner'};
$url{'Owner'} =~ s/<\/?B>//g;
$rec{'Training'} =~ s/\n/<BR>/g;
$rec{'Organizations'} =~ s/\n/<BR>/g;
print qq|
<TABLE WIDTH="350" CELLPADDING=2 CELLSPACING="0" style="border: 1px #000000 solid" bgcolor="#949C94">
<tr>
<td width="100%" colspan="2" style="border-bottom: 1px #000000 solid" bgcolor="#949C94"><b><font face="Arial" size="2">$rec{'Horse'} $rec{'Title'} (#$rec{'Registration'})</font></b></td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><i><font size="1" face="Arial">($rec{'Sire'} x $rec{'Dam'})</font></i></td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Age'} $rec{'Color'} $rec{'Breed'} $rec{'Gender'} ($rec{'Height'})<br>
Currently resides at $rec{'Stabled At'}</font></td>
</tr>
<tr>
<td width="25%" bgcolor="#DEE7DE" valign="top"><font size="1" face="Arial"><u>Training</u><br>
$rec{'Training'}</font></td>
<td width="75%" valign="top" bgcolor="#DEE7DE"><font size="1" face="Arial"><u>Markings</u><br>
$rec{'Markings'}</td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Horse'} came
into OtB with $rec{'ImportedPoints'} points.</font></td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Horse'}
currently has a total of $rec{'Points'} points.</font></td>
</tr>
<TR>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><$font_color><font size="1" face="Arial">
|;
}
if ($rec{'Title'}) {
print qq|
$rec{'Horse'}
reached the $rec{'Title'} status on $rec{'Date Title'}.
|;
}
else {
print qq| <TR>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><$font_color><font size="1" face="Arial">$rec{'Horse'}
has not yet reached the status of any of OtB's titles.</font></td></TR> |;
}
print qq|
</font></td></TR>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Horse'} last
saw the vet on $rec{'Vet'}.</font></td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Horse'} last
saw the farrier on $rec{'Farrier'}.</font></td>
</tr>
<tr>
<td width="25%" valign="top" bgcolor="#DEE7DE"><font size="1" face="Arial"><u>Organizations</u><br>
$rec{'Organizations'}</font></td>
<td width="75%" valign="top" bgcolor="#DEE7DE"><font size="1" face="Arial"><u>Previous Owners</u><br>
$rec{'Owners'}</font></td>
</tr>
<tr>
<td width="100%" valign="top" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">For
more information on $rec{'Horse'}, contact <a href="mailto:$url{'Owner'}">$rec{'Owner'}</a>.</font></td>
</tr>
</TABLE>
|;
}
Now, even if I take out the ELSE statement, it still doesn't work. I've tried putting the table tags inside and outside of the print qq||; and it just brings up the internal error statement. Can anyone help me to get this to work?
(Also, all of my CHMods are correct and it was uploaded under ASCII. If I take out the IF statement, it works fine. But as soon as it's included, it screws up.)
Thanks so much,
-Reyhan
sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
my (%rec) = @_; # Load any defaults to put in the VALUE field.
($db_auto_generate and print &build_html_record(%rec) and return);
my $font_color = 'Font face="Arial" Size="1" Color=#000000';
my $font = 'Font face="Arial" Size="1"';
$url{'Owner'} = $rec{'Owner'};
$url{'Owner'} =~ s/<\/?B>//g;
$rec{'Training'} =~ s/\n/<BR>/g;
$rec{'Organizations'} =~ s/\n/<BR>/g;
print qq|
<TABLE WIDTH="350" CELLPADDING=2 CELLSPACING="0" style="border: 1px #000000 solid" bgcolor="#949C94">
<tr>
<td width="100%" colspan="2" style="border-bottom: 1px #000000 solid" bgcolor="#949C94"><b><font face="Arial" size="2">$rec{'Horse'} $rec{'Title'} (#$rec{'Registration'})</font></b></td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><i><font size="1" face="Arial">($rec{'Sire'} x $rec{'Dam'})</font></i></td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Age'} $rec{'Color'} $rec{'Breed'} $rec{'Gender'} ($rec{'Height'})<br>
Currently resides at $rec{'Stabled At'}</font></td>
</tr>
<tr>
<td width="25%" bgcolor="#DEE7DE" valign="top"><font size="1" face="Arial"><u>Training</u><br>
$rec{'Training'}</font></td>
<td width="75%" valign="top" bgcolor="#DEE7DE"><font size="1" face="Arial"><u>Markings</u><br>
$rec{'Markings'}</td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Horse'} came
into OtB with $rec{'ImportedPoints'} points.</font></td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Horse'}
currently has a total of $rec{'Points'} points.</font></td>
</tr>
<TR>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><$font_color><font size="1" face="Arial">
|;
}
if ($rec{'Title'}) {
print qq|
$rec{'Horse'}
reached the $rec{'Title'} status on $rec{'Date Title'}.
|;
}
else {
print qq| <TR>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><$font_color><font size="1" face="Arial">$rec{'Horse'}
has not yet reached the status of any of OtB's titles.</font></td></TR> |;
}
print qq|
</font></td></TR>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Horse'} last
saw the vet on $rec{'Vet'}.</font></td>
</tr>
<tr>
<td width="100%" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">$rec{'Horse'} last
saw the farrier on $rec{'Farrier'}.</font></td>
</tr>
<tr>
<td width="25%" valign="top" bgcolor="#DEE7DE"><font size="1" face="Arial"><u>Organizations</u><br>
$rec{'Organizations'}</font></td>
<td width="75%" valign="top" bgcolor="#DEE7DE"><font size="1" face="Arial"><u>Previous Owners</u><br>
$rec{'Owners'}</font></td>
</tr>
<tr>
<td width="100%" valign="top" colspan="2" bgcolor="#DEE7DE"><font size="1" face="Arial">For
more information on $rec{'Horse'}, contact <a href="mailto:$url{'Owner'}">$rec{'Owner'}</a>.</font></td>
</tr>
</TABLE>
|;
}
Now, even if I take out the ELSE statement, it still doesn't work. I've tried putting the table tags inside and outside of the print qq||; and it just brings up the internal error statement. Can anyone help me to get this to work?
(Also, all of my CHMods are correct and it was uploaded under ASCII. If I take out the IF statement, it works fine. But as soon as it's included, it screws up.)
Thanks so much,
-Reyhan