Gossamer Forum
Home : Products : DBMan : Customization :

only one record displays

Quote Reply
only one record displays
i have following sub
Code:
sub get_modal {
#---------------------------------------------------------
my ($output,$link,%save_in);
%save_in = %in;
&switch_to_docs;
undef %in;
$in{'Type'} = 'Webguide';
$in{'SubType'} = $db_def;
my ($status2,@hits2) = &query2("view");
%in = %save_in;


# If there are any search results
if ($status2 eq "ok") {
# Calculate the number of records returned
my ($numhits2) = ($#hits2+1) / ($#db2_cols+1);

$output .= qq|<div class="modal fade" id="helpModal" tabindex="-1" role="dialog" aria-labelledby="helpModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="helpModalLabel">Help</h5>\n
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>\n
</div>
<div class="modal-body">
<p>[Topics open in new tab]</p>|;
for (0 .. $numhits2 - 1) {
%rec2 = &array_to_hash2($_, @hits2);
$link = "$db_script_url?db=docsx&amp;uid=$db_uid&amp;view_records=1&amp;$db_key=$rec2{$db2_key}";
$output .= qq|<p class="modal-title"><a href="$link" target="_blank">$rec2{'Title'}</a></p>\n|;
}
$output .= qq|</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>\n
</div>
</div>
</div>
</div>|;

}
else { #no help
$output .= qq|<div class="modal fade" id="helpModal" tabindex="-1" role="dialog" aria-labelledby="helpModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="helpModalLabel">Help</h5>\n
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>\n
</div>
<div class="modal-body">
<p>No help found</p>|;
$output .= qq|</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>\n
</div>
</div>
</div>
</div>|;
}


return ($output);
}
if status2 is ok, i.e. it finds a record in sub table, the script cannot find but one record in my main table. actually, i think it finds all the records but only displays the first. if it doesn't find anything in docs, the main/current table displays all the appropriate records.
$pagehelp = &get_modal; is called after the navbar and displays correctly in either case. source code for the page looks fine and validates at w3c. any idea what could be causing the problem?
Quote Reply
Re: [delicia] only one record displays In reply to
figured it out. query2 had a variable that should have been local but wasn't