Wow, hard to say but you definitely have some problems. For example, the
typo in "visits.viist(+=1)". Are you getting error messages or is it just
not doing what you want?
Something like this perhaps? This code only adds one line to what is shown
in the Book: image.update_record(visits=image.visits + 1). One thing to do
is only make one "db.table" call per controller. You usually only need to
access the database once per table. And in this case, you only need to do an
image.update_record to increment the visits.
def show():
image = db.image(request.args(0)) or redirect(URL('index'))
db.comment.image_id.default = image.id
form = crud.create(db.comment,
message='your comment is posted',
next=URL(args=image.id))
comments = db(db.comment.image_id==image.id).select()
image.update_record(visits=image.visits + 1)
return dict(image=image, comments=comments, form=form)
=== show.html ===
...
<p>Visits: {{=image.visits}}</p>
...