> controller/default/index.py > ... > form =SQLFORM(Post, formstyle='table3cols') > if request.vars.message: > db.post.insert(message=request.vars.message) > pass > String = '' > for s in db(db.post.author==auth.user.id).select(db.post.ALL): > String = s.message >
First, you don't need to loop through all the records just to get the last one -- instead, just index with [-1]. Or better yet, have the db sort in reverse order and use limitby=(0, 1) to get the last record. Anyway, in the code above, the final value of String should be the message from the record inserted above. Perhaps the error is somewhere in the code you haven't shown (e.g., the view code). Also, not sure what you mean by "refreshing the database". Anthony -- 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/d/optout.