[Chicago-talk] Concactenate results from perl DBI fetchall_hashref
imran javaid
imranjj at gmail.com
Mon Aug 24 09:26:31 PDT 2015
There is more than one way to skin this cat.
Did you try this?
<label><input type="checkbox" value="<% Accomp.$ID.ID <http://id.id/> %>"><%
Accomps.$ID.NAME <http://id.name/> %><% Accomps.$ID. <http://id.name/>
descrip %></label>
or you could change query:
my $q = "SELECT ID, NAME, descrip, NAME || descrip as COMBINED
FROM accomp_type
WHERE repair = ?
ORDER BY NAME";
and refer to it as:
<label><input type="checkbox" value="<% Accomp.$ID.ID <http://id.id/> %>"><%
Accomps.$ID. <http://id.name/>COMBINED %></label>
Note that in either case, there is no space between NAME and descrip. You
can add that if you want.
-imran
On Sun, Aug 23, 2015 at 5:35 PM, <richard at rushlogistics.com> wrote:
> I fetch the following rows as follows
>
> my $q = "SELECT ID, NAME, descrip
> FROM accomp_type
> WHERE repair = ?
> ORDER BY NAME";
> my $sth = $dbh->prepare($q);
> $sth->execute($rep_id);
> my $accomp_ref = $sth->fetchall_hashref('ID');
>
> I would like to combine NAME and descrip into NAME so that in my
> page when
> I do:
> <label><input type="checkbox" value="<% Accomp.$ID.ID
> %>"><% Accomps.$ID.NAME %></label>
>
> Name and description will appear instead of the name only. Can anyone tell
> me how I can accomplish this?
>
> Thanks for any help.
>
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/chicago-talk/attachments/20150824/1854367d/attachment.html>
More information about the Chicago-talk
mailing list