in reply to [Solved]: Can we use print <<HTML; twice in same file?

Updated subject to mention this is solved. Also I figured that I had to use first element of @row while it loops through all the rows and use only that element.

So I created a new array @widget and kept adding first element from @row while it iterates over all the rows of result. And finally using elemtnts of this new array.

my @widget; while (my @row = $sth->fetchrow_array) { push(@widget, $row[0]); }

Replies are listed 'Best First'.
Re^2: [Solved]: Can we use print <<HTML; twice in same file?
by 1nickt (Canon) on Aug 25, 2015 at 19:31 UTC

    You should change your SQL so it only fetches the data you want. Alternatively, see DBI.pm#selectcol_arrayref

    .
    The way forward always starts with a minimal test.
Re^2: [Solved]: Can we use print <<HTML; twice in same file?
by poj (Abbot) on Aug 25, 2015 at 19:46 UTC

    What is in the NAME field of comm_desk_widget_status. Are they names like 'trunk_usage','post_ivr', etc ?

    poj
      mysql> desc comm_desk_widget_status; +--------------+--------------+------+-----+-------------------+ | Field | Type | Null | Key | Default | +--------------+--------------+------+-----+-------------------+ | user | varchar(100) | NO | PRI | NULL | | name | varchar(200) | NO | PRI | | | display | varchar(200) | NO | | NULL | | active | int(1) | NO | | 1 | | ts | timestamp | NO | | CURRENT_TIMESTAMP | | last_updated | varchar(100) | YES | | NULL | +--------------+--------------+------+-----+-------------------+
      This is the table description.

        But what is in the name field ?. I ask because you seem to be using the sort order on that field to match the order of input fields on your page.

        poj