Hi On Saturday 01 August 2009 16:47:41 Pynthon Pynthon wrote: > Hey > > Maybe I will switch back to Web2Py but I still have some questions :P. > > 1. Why it is here http://pastebin.com/f4c8cd718 db().select(query) and here > http://pastebin.com/m291dbd6d db(query).select?
Simply: first parentheses contain the query, things that would go into the WHERE clause in sql. And in select parentheses goes everything else, starting with the fields you want to get back. Continuing with orderby, limitby, having, groupby, not in any specific order. In first case: leden = db().select( db.leden.ALL, orderby = db.leden.ALL ) it will return all records with all fields from table leden. Can't really tell what order by will do here... though. It expects a field or list of fields In second case: all = db( db.leden.id == request.args[0] ).select() It will return records where the id of table leden corresponds to the given parameter. When select is empty it returns all fields. > 2. What does here http://pastebin.com/m3869a9b the [0] in the line and at > the end? query: all = db( db.leden.id == request.args[0] ).select()[0] queries trough DAL will always return list of records, even if it's only one element. Because id is unique, only one record will be selected, and it will be returned as the only element of the list. So with [0] you get that one record. > 3. What does here http://pastebin.com/m1c7e0e1 the request mean? redirect( URL( r = request, f = 'index' ) ) URL expects several parameters from what to create an url. Those include application, control, function, arguments, variables... the request global variable contains all of this data for the current request. If URL doesn't find one of the parameters it will take it from the r parameter which is the request. > > Thanks > F-X > regards mmlado --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---