[Zope] ZSQL Advice needed - no results, one match, multiple matches

sdduncan@indiana.edu sdduncan@indiana.edu
Thu, 22 Mar 2001 22:48:15 -0000


I would like to query a mysql database for a persons ID number for
further processing.  I have them enter their Last Name into a form
(actually they can enter the first few letters of their name and I use
the like operator).


Please enter your last name _______  [submit]


If there are no matches I want to print out that fact
IF there is one match I want to display the results of an sql query
based on the personID

If there is more than one match I want to bring up a selection box
so they can select the correct name and than get the results from that 
personID

What I tried was using sequence-length like:

<dtml-if "_[sequence-length']==1">

      Display information about the Person

<dtml-if "_['sequence-length'] > 1">

      Put up a selection box

<dtml-else>

    Sorry we did not find a match in our database

</dtml-if>

  But this approach does not work. <dtml-else> is never seen.

When I have done this before (using PHP) I could check on the results
from  $num = mysql_num_rows($queryHandle)

I get the feeling I am pounding away with my php hammer when there is
a better zope nail out there.

What would be the Zope way to do this?

-Shan