Do a query something like this

name_check = web.query("select * from `tablename` where name=yourname)

if the name is  not in table  len(name_check) will be 0 , if name is
available it will return some data which makes len(name_check) != 0.

Hoping this makes sense, and let's see for any better solutions.

On 8/12/07, polymath <[EMAIL PROTECTED]> wrote:
>
>
> Hi,
> I'm new to web.py and MySQL.  I'm trying to write a web app that
> involves getting a name from the user, it then should check the MySQL
> table for a entry w/ the given name.  I'm not exactly sure how to go
> about it.   I would like to check if an entry for the name already
> exists in the MySQL table and if it doesn't, the program would add
> one.
>
> If I query for the name whether it exists in the table or not, my
> debugging code prints out the query as a string and shows something
> like "<web.utils.IterBetter instance at 0x4048f28c>".  If the name
> exists and I try to access query.name, that's all well and good.  But
> if the name doesn't exist in the table already and I try to access
> query.name, the debugger reports: "IterBetter instance has no
> attribute 'item_name'".
>
> Is there a good way I can make the program do what I want it to?
> Please let me know.  Thank you very much for your time :).
>
> Best Regards,
> Van Nguyen
>
>
> >
>


-- 
ashok raavi

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

Reply via email to