monsterbuilt
09-02-2006, 01:42 PM
Hello,
I'm at a loss here and tried everything. All I want is "if" there are no results form the SQL statement to say so with my "else". any advice?
my $sth = $dbh->prepare(qq(select eviction_record_id,applicant_id,eviction_date,eviction_court,eviction_status,occurred_within_three_y ears,plantiff_name,address_of_eviction from eviction_record where applicant_id = '$applicant_id' )) or &dbdie;
$sth->execute or &dbdie;
while (($eviction_record_id,$applicant_id,$eviction_date,$eviction_court,$eviction_status,$occurred_within _three_years,$plantiff_name,$address_of_eviction) = $sth->fetchrow_array) {
if ($eviction_record_id) {
print qq (
<table id="simpleTable" >
<tr>
<th colspan="5" nowrap="nowrap" align="left">Evictions found:</th>
</tr>
<tr>
<th align="left" nowrap="nowrap">Eviction Date</th>
<th align="left" nowrap="nowrap">Plantiff Name</th>
<th align="left" nowrap="nowrap">Eviction Court</th>
<th align="left" nowrap="nowrap">Eviction Status</th>
</tr>
<tr>
<td align="left" nowrap="nowrap">$eviction_date</td>
<td align="left" nowrap="nowrap">$plantiff_name</td>
<td align="left" nowrap="nowrap">$eviction_court</td>
<td align="left" nowrap="nowrap"><b>$eviction_status</b></td>
</tr>
</table>
);
} else {
print qq (
<center>No eviction records found.</center>
);
}
}
I'm at a loss here and tried everything. All I want is "if" there are no results form the SQL statement to say so with my "else". any advice?
my $sth = $dbh->prepare(qq(select eviction_record_id,applicant_id,eviction_date,eviction_court,eviction_status,occurred_within_three_y ears,plantiff_name,address_of_eviction from eviction_record where applicant_id = '$applicant_id' )) or &dbdie;
$sth->execute or &dbdie;
while (($eviction_record_id,$applicant_id,$eviction_date,$eviction_court,$eviction_status,$occurred_within _three_years,$plantiff_name,$address_of_eviction) = $sth->fetchrow_array) {
if ($eviction_record_id) {
print qq (
<table id="simpleTable" >
<tr>
<th colspan="5" nowrap="nowrap" align="left">Evictions found:</th>
</tr>
<tr>
<th align="left" nowrap="nowrap">Eviction Date</th>
<th align="left" nowrap="nowrap">Plantiff Name</th>
<th align="left" nowrap="nowrap">Eviction Court</th>
<th align="left" nowrap="nowrap">Eviction Status</th>
</tr>
<tr>
<td align="left" nowrap="nowrap">$eviction_date</td>
<td align="left" nowrap="nowrap">$plantiff_name</td>
<td align="left" nowrap="nowrap">$eviction_court</td>
<td align="left" nowrap="nowrap"><b>$eviction_status</b></td>
</tr>
</table>
);
} else {
print qq (
<center>No eviction records found.</center>
);
}
}