Hi All,
I am trying to fill a popup_menu with values retrieved from my database and get the following error. Can't coerce array into hash at. As this is the first time I'm doing this, could someone please assist in telling me where I'm going wrong.
$db="wotdb";
$host="test";
$port="436";
$userid="wot";
$passwd="wot";
$connectionInfo="DBI:mysql:database=$db;$host:$port";
$dbh = DBI->connect($connectionInfo,$userid,$passwd) || die("Could not get connected!");
my @ids = (); my %hostname = ();
$query = "SELECT * FROM hosts, ping_test where hosts.hostname=ping_test.ping_hostname";
$sth = $dbh->prepare($query);
$sth->execute();
my($hostname,$hostip,$hostport);
$sth->bind_columns(\$hostname,\$hostip,\$hostport,\$ping_date,\$ping_time,\$ping_hostname,
\$ping_hostip,\$ping_bytes,\$ping_icmp_seq,\$ping_timems,\$ping_tot_pack_trans,
\$ping_tot_pack_rec,\$ping_perc_pack_loss,\$ping_conn_status);
while(my($id,$hostname)=$sth->fetchrow_array) { push(@ids,$id); $hostname{"$id"} = $hostname; }
print start_form,;
print "<br>";
print "<center><table border=0 cellpadding=3 cellspacing=1>";
print "<tr>";
print popup_menu('name'=>'hostname', 'values'=>[EMAIL PROTECTED],'default'=>$hostname,'labels'=>\%hostname);
print "</tr>";
print "</table></center>";
-- Kind Regards, Werner Otto
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>