db.tablename.fieldname is just another way to access db[tablename][fieldname] . More or less like a Storage
On Tuesday, September 24, 2013 11:46:22 PM UTC+2, ewon...@gmail.com wrote: > > Is there any way to use a variable for a db table name as part of a query? > > Say if I have multiple tables with a field called "name" could I create a > function such as this? > > > > def query_db(tbl, my_name): > > for row in db(db.tbl.name==my_name).select(): > > [code here] > > > > So that calling query_db('example', 'bob') would have it query db( > db.example.name=='bob') > > As written it does not work, but is there some other syntax I could use to > carry out what I want? > -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.