[Zope-dev] Easy SQL question

2001-01-08 Thread Keith . Larson

Hello ,

I am trying to pull text from a Mysql DB into a page inside zope.

I have the ZMYSQL connection setup and tested .

for example :
select renderText From Phrases where phrase_id = 3 and lang =1

I have also gotten the ZSQL method tested and working

example :
   
 Arguments 
   


phrase_id
renderText


   Query
   template 




select renderText from Phrases
dtml-sqlgroup where
dtml-if expr="phrase_id"
dtml-sqltest name="phrase_id" type="int" 
/dtml-if
/dtml-sqlgroup

change and test enter 3 for  phrase id and I get the correct info
SQL used:
select renderText from Phrases
where
phrase_id = 3

Now for the duh section.

All of the above works fine with a submit button and entering info ,

I would like to pull the info into a Zope HTML page.

I believe that this is close

dtml-call "REQUEST.set('phrase_id', foo)"

   dtml-in expr="langtest()"
  dtml-var expr="_['sequence-item'].renderText"
   /dtml-in

but is foo supposed to be my var of whatever I want passed ?

 how do I pass the variable for phrase ID ( via a variable and changed per
request ) to the language test and display the results so the user never
knows .

I think I am close just missing the obvious I think anyhelp ?




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Easy SQL question

2001-01-08 Thread Steve Alexander

[EMAIL PROTECTED] wrote:

 
 I believe that this is close
 
 dtml-call "REQUEST.set('phrase_id', foo)"
 
dtml-in expr="langtest()"
   dtml-var expr="_['sequence-item'].renderText"
/dtml-in
 
 but is foo supposed to be my var of whatever I want passed ?
 
  how do I pass the variable for phrase ID ( via a variable and changed per
 request ) to the language test and display the results so the user never
 knows .
 
 I think I am close just missing the obvious I think anyhelp ?

You need to explicitly pass in arguments to a ZSQL Method as keyword 
arguments. So, the following will probably work.

  dtml-in expr="langtest(phrase_id=phrase_id)"
dtml-var expr="_['sequence-item'].renderText"
  /dtml-in

--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )