Hello, I have huge problem here, mainly because of my lack of knowledge and understanding of Z SQL methods, I really need some help, and I am hopeing some one would be willing to give me some light on the following issue: I have succeded in creating a dtml form and sql method base on the marvelous how-to recently posted on the subject, but I have different needs, I have created a Mysql database that serves to generate users accounts, and collects many info from them, the problem here is that I made the database with two indexes one with the auto-increment feature (no problem here) and a second one the email field that I have instuct mysql should be unique too, and thus when a user gets created if the email address exists, mysql won't allow insertion of new data base on the previous rule which is exactly what I want it to do, my problem is that I need to test this condition before so that if the email exists then the user gets a message telling her/him that either she/he most choose another email address, to avoid the error screen, or edit his current record which would need a some sort of validation as being the rightfull owner of the afore mention account. I know this might be to much to as of you all, but I am really stuck I have try many approaches unseccesfully and thats why I ask of you to help me if you will... Thanks a lot in advanced... Sam
Checking if the email already exists is simple: ZSQL method (let's call it check_email): select count(*) as the_count from db where email=<dtml-sqlvar email type=string> DTMLDocument: <html> . . . <dtml-in "check_email(email=email_form_form)"> <p>You have already rgistered, please login to make changes to your account, or click here to have your password emailed to you.</p> <dtml-else> <dtml-call "register_user(email=email_from_form)"> You have been registered. </dtml-in> . . . </html> However checking whether that person is the rightful owner of the email address is IMO not possible. There might be a way of connecting to the pop server and asking it if the user exists, but this could under certain circumstances be *extremely* slow. HTH Phil phil@philh.org -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Francisco Sam Castillo Sent: 25 September 1999 22:44 To: zope@zope.org Subject: [Zope] Z SQL question.. Hello, I have huge problem here, mainly because of my lack of knowledge and understanding of Z SQL methods, I really need some help, and I am hopeing some one would be willing to give me some light on the following issue: I have succeded in creating a dtml form and sql method base on the marvelous how-to recently posted on the subject, but I have different needs, I have created a Mysql database that serves to generate users accounts, and collects many info from them, the problem here is that I made the database with two indexes one with the auto-increment feature (no problem here) and a second one the email field that I have instuct mysql should be unique too, and thus when a user gets created if the email address exists, mysql won't allow insertion of new data base on the previous rule which is exactly what I want it to do, my problem is that I need to test this condition before so that if the email exists then the user gets a message telling her/him that either she/he most choose another email address, to avoid the error screen, or edit his current record which would need a some sort of validation as being the rightfull owner of the afore mention account. I know this might be to much to as of you all, but I am really stuck I have try many approaches unseccesfully and thats why I ask of you to help me if you will... Thanks a lot in advanced... Sam _______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope (To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Francisco Sam Castillo -
Phil Harris