Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re^3: Perl and DBI and CGI

by monkey_boy (Priest)
on Jun 23, 2005 at 13:26 UTC ( #469385=note: print w/replies, xml ) Need Help??

in reply to Re^2: Perl and DBI and CGI
in thread Perl and DBI and CGI

You would be better specifying the column names in the sql, thus would be able to help you more, also dont forget to close your font tags , something like this:
my $ref = $dbh->selectall_arrayref(" select name , email , age from users ") || die $dbh->errstr; foreach my $person (@{$ref}) { my ($name,$email,$age) = @{$person}; print "<font color=\"red\" > $name </font>"; print "<font color=\"blue\"> $email </font>"; };

This is not a Signature...

Replies are listed 'Best First'.
Re^4: Perl and DBI and CGI
by sOKOle (Acolyte) on Jun 23, 2005 at 13:53 UTC
    monkey_boy, your script works, but main problem re-occured When I have "Dr. John Bull" field it prints "Dr." only... could you solve ?
      Im finding it hard to help as you dont provide data for us!
      What does this print?

      use Data::Dumper; my $ref = $dbh->selectall_arrayref("select * from users") || die $dbh->errstr; print Dumper($ref);

      This is not a Signature...

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://469385]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (1)
As of 2021-10-22 02:39 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (85 votes). Check out past polls.