You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Scott Chapman <sc...@mischko.com> on 2002/02/05 20:58:27 UTC
Why does Recordset give headers with each data line?
Here's the output I'm getting. The ar_id lines are bold. I expect from the EPL
file to get just one header line. What am I missing here? This is DBI::Sprite
for the database engine. Running under WIndows.
ar_id datetime eventcode user info
1 1012334551 CreateReview nobody
ar_id datetime eventcode user info
1 1012334552 ReviewDirectory nobody wteicbqv
ar_id datetime eventcode user info
1 1012334552 CreatorEmail nobody scott@lund.com
ar_id datetime eventcode user info
2 1012334733 CreateReview nobody
Here's the EPL file I'm running. It's the example from the DBIx::Recordset
Intro docs:
<body> <h1>Contents of table ``[+ $fdat{'!Table'} +]''</h1>
[-
$req = shift;
use DBIx::Recordset ;
$fdat{'!DataSource'} = $req->{website_database};
$fdat{'!Username'} = $req->{db_user};
$fdat{'!Password'} = $req->{db_pass};
*set = DBIx::Recordset -> Search(\%fdat) ;
$names = $set -> Names ;
-]
<table>
<tr>
<th>[+ $names -> [$col] +]</th>
</tr>
<tr>
[- $rec = $set[$row] -]
<td>[+ $rec -> {$names->[$col]} +]</td>
</tr>
</table>
</body>
Any help would be greatly appreciated!
Scott
---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org
Re: Why does Recordset give headers with each data line?
Posted by Gerald Richter <ri...@ecos.de>.
> Why does Recordset give headers with each data line?
This is not a problem of Recordset, but of your Embperl code. I guess you
are using Embperl 2.0. 2.0 doesn't recognizeds the <th> tag. So while your
code would work with 1.3, it doesn't with 2.0. Just add one if and it will
work again:
>
> <table>
[$ if $row == 0 $]
> <tr>
> <th>[+ $names -> [$col] +]</th>
> </tr>
[$endif$]
> <tr>
> [- $rec = $set[$row] -]
> <td>[+ $rec -> {$names->[$col]} +]</td>
> </tr>
> </table>
> </body>
>
Gerald
P.S. By change the if condtion to $row % 10 == 0 you get a header line each
10 rows, which is often nices if your table contains more than a few lines
-------------------------------------------------------------
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