mrimagepueblo
Programmer
I am attempting to print the results of an array, @database rows which shows the results of 5 records in my database. I need to populate showAddress with each record in the array to put those fancy markers in a google map. If I manually put showAddress in the spot below 5 times with 5 address the markers show perfectly. For reasons beyond me, it's knocking off the first 4 entries. I put in some code to print to the file debugging.txt and it's writing only the last record of the 5 search results.
I'm working with an existing program and have a little understanding of perl, but not enough to make it work.
debugging.txt has this in it's content. (some of the record is truncated as it's very long.
105535|1950000|R|A|1306|S||Liberty Point Blvd|Pueblo West|CO|81007|7|6|12|47|
code snippet:
sub search_results_header
{
print qq~
<head>
head code
</head>
foreach $key (keys(%db))
{
if ($form_data{$key} ne "")
{
print qq~
<INPUT TYPE = "hidden" NAME = "$key"
VALUE = "$form_data{$key}">
~;
}
}
}
sub search_results_body
{
if ($total_row_count >1)
foreach $row (@database_rows)
{
@fields = split (/\|/, $row);
<!-- routine to see what's in $row -->
open W,'>debugging.txt';
print W $row;
close W;
print "$row\n";
<!-- end routing to see what's in $row
<! -- display 5 search results -->
print qq~
<!-- begin google map javascript code -->
<script type="text/javascript">
//<![CDATA[
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
<!-- end google map javascript code -->
//]]>
</script>
<!-- begin displaying map -->
<div id="map" style="width: 500px; height: 300px"> </div>
<!-- end displaying map -->
<!-- display code for thumbnail -->
code
code
code to display footer
-----------------------------------
utlimately in the javascript section I should have 5 occurences, one for each $row.
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
I'm working with an existing program and have a little understanding of perl, but not enough to make it work.
debugging.txt has this in it's content. (some of the record is truncated as it's very long.
105535|1950000|R|A|1306|S||Liberty Point Blvd|Pueblo West|CO|81007|7|6|12|47|
code snippet:
sub search_results_header
{
print qq~
<head>
head code
</head>
foreach $key (keys(%db))
{
if ($form_data{$key} ne "")
{
print qq~
<INPUT TYPE = "hidden" NAME = "$key"
VALUE = "$form_data{$key}">
~;
}
}
}
sub search_results_body
{
if ($total_row_count >1)
foreach $row (@database_rows)
{
@fields = split (/\|/, $row);
<!-- routine to see what's in $row -->
open W,'>debugging.txt';
print W $row;
close W;
print "$row\n";
<!-- end routing to see what's in $row
<! -- display 5 search results -->
print qq~
<!-- begin google map javascript code -->
<script type="text/javascript">
//<![CDATA[
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
<!-- end google map javascript code -->
//]]>
</script>
<!-- begin displaying map -->
<div id="map" style="width: 500px; height: 300px"> </div>
<!-- end displaying map -->
<!-- display code for thumbnail -->
code
code
code to display footer
-----------------------------------
utlimately in the javascript section I should have 5 occurences, one for each $row.
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");
showAddress("$fields[4] $fields[5] $fields[7] $fields[8], $fields[9] $fields[10]","$fields[4] $fields[5] $fields[7]<br />$fields[8], $fields[9] $fields[10]");