baperl has asked for the wisdom of the Perl Monks concerning the following question:
Can you please let me know where my error is. thanks!sub print_response { unless ($query->param) { print "<b>No data has been submitted</b>"; return; } $sql = "SELECT col1, col2 FROM test ORDER BY col2 desc;"; $sth=$dbh->prepare($sql) or die $dbh->errstr; $sth->execute; print "</td><td>"; print "<table border>"; print "<tr>"; print "<th>col1</th>"; print "<th>col2</th>"; print "</tr>"; while (my $hash_ref = $sth->fetchrow_hashref) { $the_st = $hash_ref->{'col1'}; $the_mc = $hash_ref->{'col2'}; print "<tr><td>$the_st</td><td align=\"right\">$the_mc</td></tr> +"; } print "</table></td></tr></table>"; $sth->finish; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: post data from db on website
by moritz (Cardinal) on Oct 10, 2011 at 16:11 UTC | |
by baperl (Sexton) on Oct 10, 2011 at 16:38 UTC | |
by cavac (Prior) on Oct 10, 2011 at 17:34 UTC |