You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by "Boyd, David" <db...@nisys.com> on 2001/08/27 16:34:23 UTC
Help on using DBIx
I am trying to do a simple select statement and display the results into a
pull down list, but it does not seem to work.
here is the code that I am using:
[-
#-------------------
# database parameter
#-------------------
$fdat{'!DataSource'} = GetDSN();
$fdat{'!Table'} = 'unanet_employee';
$fdat{'!Fields'} = "employee_key, first_name || ' ' ||
last_name";
$fdat{'=search'} = 'ok';
#-------------------
# execute action according to the query parameters
#-------------------
*employeeDat = DBIx::Recordset -> Execute (\%fdat);
-}
<table border='0'>
<tr>
<td>Employee:</td>
<td>
<select
name="assignment.employee_key" class="assignment.employee_key"
id="assignment.employee_key" onChange='document.Form1.emailAddress.value =
this.value;'>
<option value='[+
$employeeDat[$row] +]'>[+ $employeeDat[$row] +]</option>
</select>
</td>
</tr>
</table>
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Help on using DBIx
Posted by Gerald Richter <ri...@ecos.de>.
You need to give column names when a accessing the result:
$fdat{'!Fields'} = "employee_key, first_name || ' ' || last_name as
name";
...
<option value='[+$employeeDat[$row]{employee_key} +]'>[+
$employeeDat[$row]{name} +]</option>
or even better leave out the $row in the second expression, because
otherwise the loop will end when you have an name that return NULL (i.e.
undef)
<option value='[+$employeeDat[$row]{employee_key} +]'>[+ $employeeDat{name}
+]</option>
Gerald
-------------------------------------------------------------
Gerald Richter ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting
Post: Tulpenstrasse 5 D-55276 Dienheim b. Mainz
E-Mail: richter@ecos.de Voice: +49 6133 925131
WWW: http://www.ecos.de Fax: +49 6133 925152
-------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org