> Dovalle Yankelovich wrote:
> 
> Hi,
> I want to read some data from a table of MySql then take every element I
> got and put it as item in html list box.
> I will appreciate if someone could help me
> Thanks
> 

You could use DBI + DBD::mysql to retrieve the data from the table,
something like this:

#!perl
use warnings;
use strict;
use DBI;

my $dsn = 'data_source';
my $dbd = 'mysql';
my $uid = '';
my $pwd = '';
my $attr = {RaiseError=>1,PrintError=>0,LongTruncOk=>1};

my $dbh = DBI->connect("dbi:$dbd:$dsn",$uid,$pwd,$attr) 
        or die "Error connecting to datasource '$dsn': $DBI::errstr\n";

my $sql = q{SELECT id, value FROM table ORDER BY 2};
my $sth = $dbh->prepare($sql);
$sth->execute;

my $html = q{<SELECT>};
while (my $row = $sth->fetch) {
  $html .= qq{<OPTION VALUE="$row->[0]">$row->[1]</OPTION>};
}
$html .= q{</SELECT>};

print $html;

$dbh->disconnect;

-- 
  Simon Oliver
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to