db.select('todo') #selects all
db.select('todo', i, where="id = $id") #selects record matching id#
UPDATE
db.update('todo', title=i.title, id=i.id) #updates row where id matches id#
(the title is just the name of the field that's being updated)
INSERT
db.insert('todo', title=i.title)
DELETE
db.delete('todo', i, where="id = $id") #delete's record at the matching id#
*i hope this helps you - it's rough getting started.*
________________________________________________________
http://www.superantispyware.com/superantispyware.html?rid=3971 Remove All
The Spyware - Not Just The Easy Ones!
http://1-4-u.info | Don't send insanely long links!
Need a Pick-Me-Up? http://quotes.feedtheguru.com
On Fri, Aug 6, 2010 at 12:50 PM, Zak <[email protected]> wrote:
> Hey all,
> I have another newbie's question. I googled the question, but I can
> not find clues.
>
> An example code for a function, (Not real, just for showing 2
> instances of db.select):
>
> import web
> db = web.database(dbn='mysql', db='mydata', user='dbuser', pw='')
> results1 = db.select('mytable', where="name = $name1")
> results2 = db.select('mytable', where="age = $age")
> return (result1 + result2) ## wrong, return [results1, results2] is OK
>
> Can I combine the out of db.select results1 and results2 to a instance
> of db.select (Not by combining where clauses)? so the function can
> return an object.
>
> Thanks in advance.
>
> --
> 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] <webpy%[email protected]>.
> For more options, visit this group at
> http://groups.google.com/group/webpy?hl=en.
>
>
--
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.