[Zope] help with dtml and sql---counting database rows with sql
method
Oliver Bleutgen
myzope@gmx.net
Tue, 22 Apr 2003 00:04:21 +0200
Passin, Tom wrote:
> You are looking at the result object returned from the query - it is not an error - and it contains the info you want. But you have to extract your result from it. To see the count, remember that you are getting back a set of rows, even though there is only one row. So you treat it like any other database return -
>
> You can display the count this way (here, count_test() is your zsql method)-
>
> <dtml-in "count_test()">
> &dtml-p2_count;
> </dtml-in>
>
> or
>
> <dtml-in "count_test()">
> <dtml-var p2_count>
> </dtml-in>
Alternatively
<dtml-var "count_test()[0][0]">
gives you the 1st column of the first row of the resultset.
cheers,
oliver