When I try to execute the chunck of code (at the bottom of this page) from a
script in the browser, I receive the following error

Cannot execute:  at nationalConsumerShoppingSurvey.pl line 129.

I have isolated to something having to do with this piece of the code:

'$participantEmail'

When I replace $participantEmail with an actual email address that is in the
database in the participantEmail field the script prints the "Duplicate
Entry" message as it should.  The catch is that I have to write the address
as 'test\@test.com'.

If I change it to an address that is not in the database, I receive the same
error message as I did the first time:

Cannot execute:  at nationalConsumerShoppingSurvey.pl line 129.

I have stripped all of the leading and trailing white spaces and validated
the email address before it gets to this code block.  Does anyone have any
suggestions?

The goal is that before I submit a form submission to the database, I want
to make sure that someone with the same email address has not already
submitted it.  If the count(*) brings up anything greater than 0 then the
users has already submitted an entry and receives the "Duplicate Entry"
message.  The script stops.  If they are not in the database, then she
script proceeds to the next subroutine that enters the data into the
database.

Thanks,
Andrew


126: sub check_email_exists {
127: 
128: my $countEmail;
129: 
130: $countEmail = $dbh->selectrow_array ("select count(*) from
nationalConsumerShoppingSurvey 131: where participantEmail =
'$participantEmail'") or die "Cannot execute: $!";
132: 
133: $countEmail = int($countEmail);
134: 
135: if ($countEmail > 0) {
136:    print "Content-type:text/html\n\n";
137:    print "<html><head><title>Insider's
Advantage</title></head><body>\n";
138:    print "<h2>Duplicate Entry</h2>\n";
139:    print "<p>It appears that you have already submitted answers<br>\n";
140:    print "to this survey.  We appreciate your interest.  However, in
<br>\n";
141:    print "order to maintain the integrity of the data, we cannot allow
<br>\n";
142:    print "you to enter more than once.  We hope that you
understand.</p>\n";
143:    print "</body></html>\n";
144:    exit;
145: }
146: 
147: }

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to