Hi.
executesql will return results in "natural" form, as the library gives it.
Don't know for others, but mysql (try for others), will return a list of
tuples of results.
In your case:
person.ip_user is person[0]
person.strafb1 is person[1]
try this:
{{for person in results:}}
{{=person[0]}},
{{=person[1]}},
{{=person[2]}},
{{=person[3]}},
{{=person[4]}}<br/>
{{pass}}
The index will be from your select statement, when you count from zero for the
requested columns.
regards
mmlado
On Thursday 24 September 2009 09:33:34 shuval wrote:
> Hi! How use executesql for rows?
> controller
>
> def statistic():
> results = dbstat.executesql("""select
> ip_user,strafb1,strafb3,sostname,site from ip_adm_hist('01.09.09',
> '30.09.09',0)""")
> return dict(results=results)
>
> view
>
> {{extend 'layout.html'}}
> {{for person in results:}}
> {{=person.ip_user}},
> {{=person.strafb1}},
> {{=person.strafb3}},
> {{=person.sostname}},
> {{=person.site}}<br/>
> {{pass}}
>
> not work
> error AttributeError: 'tuple' object has no attribute 'ip_user'
>
> Thank's help
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---