Skip navigation.
Home
Your source for Perl tips, howto's, faq and tutorials
( categories: )

I am having difficulty getting my canned query to post the db entries in the first print statement. The column names post and the link to the next entries show up.

#!/usr/bin/perl

require "dbi-lib.pl"; #library from lesson 7#

#----------------------#
# User Variables #
#----------------------#

$table_name = "sqlguestbook";

#----------------------#
# Main Body #
#----------------------#
&parse_input;
&print_header;
&initialize_dbi;
&display;
exit;

#----------------------#
# Function #
#----------------------#

sub display {

$start = $FORM_DATA{'start'};
if (!$start){
$start=0;
}
#$previous = $start + 10;

print "

\n";
print "";
print "\n";

&run_statement("select * from $table_name LIMIT $start,10;");
{
$count = 1;
while (( $name, $entry_date, $email, $message) = $sth->fetchrow) {
print "

";
print "\n";
$count++;
}

print "

NumberNameDate of SubmissionEmailMessage
$count$name$entry_date$email$message
\n";
print "
\n";
print "
\n";

# prints the previous link

if ($start) {
print "Click for next ten entries";
}
else{
print "Click for previous ten entries";
}
}
}