my $id = $cgi->param( 'id' ); my $statement = $dbh->prepare( qq`SELECT Questions, Answers from QA where ID = "$id";` ); $statement->execute(); my ($question, $answer); $statement->bind_columns( \$question, \$answer ); while ($statement->fetch) { print qq`

$question

$answer

` }