Than you VERY much for the info. I managed to get your videos on Vimeo.com
and have learned a lot . I am still new in python and this is a good start.
About table/filed...
With this app, its a single table with several fields of CHAR type, fields
are numbered e.g from 1 to 25, e.g wit this app, location 15 records
desired data.The field 'id' is of type int, & incremental.
Am now confused about the database request..could you please hint at what I
can do to fix the requests.
Regards
On Sunday, April 20, 2014 4:25:43 AM UTC+3, Massimo Di Pierro wrote:
>
> You can split a string with name.split() and you can print in HTML with
> {{=a}} where a is a string or other serializable type.
> We can help you much more if you tell us the names and types of the fields
> in your table. You app is going to be very slow because you open the
> database at every request, and fetch all records at every request. This can
> be simplified a lot.
>
> On Saturday, 19 April 2014 04:57:34 UTC-5, Maurice Waka wrote:
>>
>>
>> I am trying to use web2py to build an app. I have a simple print function
>> that a user submits a key word . The string or int key word is directed to
>> an sqlite db to retrieve a row and output the data. I need to know 1. how
>> to use the print on html. 2. How to split the string...so far i did the
>> list:string
>>
>> Here is my code:
>>
>> def first():
>> form = SQLFORM.factory(Field('visitor_name',
>> label = 'Please Type Your keyword here!',
>> requires= [IS_NOT_EMPTY(),
>> IS_LOWER(),'list:string']))
>> form.element('input[type=submit]')['_onclick'] = "return \
>> confirm('Are you sure you want to submit:');"
>> if form.process().accepted:
>> session.visitor_name = form.vars.visitor_name
>> redirect(URL('main'))
>> return dict(form=form)
>>
>> def main():
>> while True:
>> name = request.vars.visitor_name or redirect(URL('first'))
>> name2 = name[:]
>> for item in name2:break
>> name3 = ' '.join(name2)
>> import sqlite3
>> id = 0
>> location = ""
>> conn = sqlite3.connect("keywords.db")
>> c = conn.cursor()
>> c.execute('select * from kmedicals')
>> records = c.fetchall()
>> for record in records:
>> id = record[0]
>> location = record[15]
>> if id == name3:
>> print name3.capitalize(),':' '\n',location
>> break
>> sys.exit()
>> return dict(name=name)
>>
>> my view...default/main.html:
>>
>> {{extend 'layout.html'}}{{=name}}
>>
>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.