On Monday, November 20, 2017 at 7:41:55 PM UTC-8, Maurice Waka wrote:
>
> In my previous question: [web2py] How to get the last DB Field data :
> I got some good response. But my issue still persists.
> My code:
>
>
> <https://lh3.googleusercontent.com/-ITVP6pmYGH0/WhOeE6ZRvTI/AAAAAAAANOE/htmOlcxFLQ8xNnjFj7v00JG4tmv4ZoWVQCLcBGAs/s1600/Screenshot%2Bfrom%2B2017-11-21%2B06-25-18.png>
> def view_searches():
>     quizy = []
>     form = SQLFORM(db.post).process()
>     if request.vars.message:
>         db.post.insert(message = request.vars.message)
>     quizes = db(db.post.author == auth.user.id).select(db.post.ALL, 
> orderby=~db.post.created_on, limitby=(0,1))
>     for q in quizes:
>         quizy.append(q.message)
>     quiz= quizy[0]
>     print quiz
>     return dict(form=form, quiz=quiz)
>
> Note the print quiz for illustration purpose.
> Now note the print screen below:
>
>
> <https://lh3.googleusercontent.com/-ITVP6pmYGH0/WhOeE6ZRvTI/AAAAAAAANOE/htmOlcxFLQ8xNnjFj7v00JG4tmv4ZoWVQCLcBGAs/s1600/Screenshot%2Bfrom%2B2017-11-21%2B06-25-18.png>
>
>
> Notice the last post is;'God is love'
>
>
>    - If using print, i get the exact last posted item
>    - if I use return on the html page, I get aowirhsgporhj......previous 
>    posted message, also shown on the terminal.
>    - Note that the html page returns the random letter print;  
> aowirhsgporhj... 
>    instead of 'God is love'
>    - I used print to illustrate the erros. If i remove print function, 
>    the error persists where i can't get the last posted item
>
> My request is how do i resolve this?
> Regards
>


Perhaps you should have gotten a clean console screen before the run that 
you wanted to include in the post :-)
It's a little bit hard to see the relevant part of the screen.

Also, did you ever show us the view template code you are using?
 
Now, commenting on your code above, I would expect quizy[0] to be the only 
element in quizy, due to your limitby=(0,1).  I am not yet seeing why your 
page isn't showing the right result yet.  I suspect something in your view, 
which is why I asked about the template code.  But what is the blue bubble 
above the Send button?  It says "God is love" ... are you putting the 
result in the wrong place?

/dps

-- 
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.

Reply via email to