i have it working to fill the form to edit it - it just will not
update - any help is appreciated (sincerely)
27 class edit:
28 def GET(self):
29 i = web.input()
30 #RTFM say to do: db.select('mytable', myvar, where="name =
$name")
31 todo = db.select('todo', i, where="id = $id")
32 #todo = db.select('todo', where="id=$id", vars={'id':100})
33 #todo = db.select(["SELECT * FROM todo WHERE id=",i
['id']])
34 #todo = db.select('todo')
35 return render.edit(todo)
36
37 class update:
38 def POST(self):
39 i = web.input()
40 #RTFM says to do: db.update('mytable', where="id = 10",
value1 = "foo")
41 db.update('todo', where="id = $id", vars =
{"title"$title})
42 #db.update('todo', vars = {'title':i.title}, where="id =
$id")
43 #db.update('todo',where="id = $id", title = i.title)
44 raise web.seeother('/')
On Nov 18, 6:00 pm, Justin Davis <[email protected]> wrote:
> See the cookbook, specifically the database entries, for reference:
>
> http://webpy.org/cookbook
>
> On Nov 18, 1:04 pm, gkbuntu <[email protected]> wrote:
>
> > if i want to edit a record in my db, how do i select the row in the db
> > by it's id? (e.g. where id = id)
>
> > the api examples do not appear to work.
>
> >http://webpy.org/docs/0.3/api#web.db
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---