[Zope] sql query that has 1 row result
Service Informatique CHSR
chsrinfo@guetali.fr
Fri, 5 Feb 1999 15:25:12 +0400
Hello,
Let sql_count_bucks be:
SELECT count(*) as Number FROM MyBucks
I know that this query will always have *one* row, and i want to use this
value. Is there a better way of writing this than:
<!--#var "sql_count_bucks()[0]['Number']"-->
kinda unreadable, isn't it? Another example: suppose i want a document to
display an article given the article id in a database. That is, i want to
display the article whose id is 2 with http://mysite.com/document?id=2
As id is the primary key, i know there will always be one article that match
the query. Is there another (better) way to write:
<!--#with "sql_query_article(REQUEST)[0]"-->
Article title: <!--#var title--><p>
Article content: <!--#var content--><p>
<!--#/with-->
It's not very important, because this way of writting works, but i wonder,
just in case i missed something in the FM.
Regards,
Jephte CLAIN
Service Informatique