Hello, I need some advice regarding a scrolling list that I've built
from a query.  I can generated the scrolling list just fine, but when I
try to put the subroutine within a table (cell), all I get is a hash
reference:

---------------------------------+---------+
Date                             | column  |
---------------------------------+---------+
date_calc(DBI::db=HASH(0xfdd40)) +    2    |
---------------------------------+---------+

Code for above output:

print start_form (-method => "post", -action => url ());
print "<table align=\"center\" border=\"1\" cellspacing=\"0\">";
print "<tr><td>Date</td><td>column</td></tr>";
print "<tr><td>date_calc($dbh)</td><td>2</td></tr>";
print "</table>";
print end_form ();

Now, if I break apart the line that generates the above, I get the
scrolling list to appear properly, but it doesn't appear in the first
cell, it appears above the table.  I get a '1' which indicates I believe
that the subroutine returned a true value: 

(scrolling list appears here)
-------+---------+
Date   | column  |
-------+---------+
1      +    2    |
-------+---------+

Code for above output:

print start_form (-method => "post", -action => url ());
print "<table align=\"center\" border=\"1\" cellspacing=\"0\">";
print "<tr><td>Date</td><td>column</td></tr>";
print "<tr><td>" . date_calc($dbh) . "</td><td>2</td></tr>";
print "</table>";
print end_form ();

Please advise what I should do to correct this.  BTW, the subroutine I'm
using for the above is as follows:

sub date_calc {
        $dbh = shift;
        ($sth, $stmt);
        $stmt = qq { select distinct When from rCam order by When desc
};
        $sth = $dbh->prepare ($stmt);
        $sth->execute ();
        print "<select name=\"dates\">";
        while ($row = $sth->fetchrow_hashref ()){
                push (@date_ary,$row->{When});
        }
        $sth->finish ();
        foreach $elt (@date_ary){
                print "<option>$elt</option>\n";
        }
        print "</select>\n";
}

Thanks,
Brian


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to