[Zope] Simplest example of INSERT

Brian Lloyd Brian@digicool.com
Wed, 2 Jun 1999 16:47:29 -0400


> I'm a total Zope newcomer, and I'm attempting to create a test thing
> where I can enter data into a form and have that data inserted into a
> table in a gadfly database. 
> 
> I've read the ZDTML guide, the Z SQL methods guide, and the managers
> guide, and none of these seem to give any examples of how to do this
> simplest task. (I've found the documentation to be absymal -- no
> examples, just definitions.)
> 
> I have a 'dataentry.html' that looks something like this:
> <form method="post" action="sqltestthing">
> Color: <input name="col">
> Flavor: <input name="fla">
> <input type=submit>
> </form>
> 
> And then a Z SQL Method 'sqltestthing':
> INSERT INTO TESTTABLE (color,flavor)
> VALUES (<!--sqlvar col type=nb-->,<!--sqlvar fla type=nb-->)
> 
> 
> I enter the data into the form page, and hit submit. I get back the
> sqltestthing page saying 'This query requires no input.' I hit submit
> again, and get 
> Error, exceptions.SyntaxError: unexpected token sequence.near ::
> 'lavor)\012VALUES ('*',) 


I think you mistyped your sqlvar tags - try changing:
<!--sqlvar col type=nb-->
to
<!--#sqlvar col type=nb-->




Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com 
>