CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Perl/MySQL script



Jun 17, 2001, 1:16 PM

Post #1 of 2 (387 views)
Perl/MySQL script Can't Post

Hello again,

I'm having more troubles with a script I'm writing. This script needs to loop through the rows of my MySQL database and match an email address to see if the user is in the database. The first few attempts I made only matched the first row and wouldn't loop through the rest. Here is the part of the script with the problem:

$sth = $dbh->prepare("select * from members");

while(my $ref = $sth->fetchrow_hashref()) {

unless($ref{'email'} eq $email) {
print qq~
Sorry, but this email is not in our database. Please be sure you are using the email that you signed up with.

If it looks screwed up now to where you start laughing, this is just 1 of 300 different variations that I tried, and now I give up and decided to ask. So it may be way off now, but I had it working with just the first row of data but it wouldn't loop through the rest. There has to be a way to put all the data into an array and loop through with a while or unless statement. I tried everything I could think of, I'm just a beginner. :)

Any help is greatly appreciated!


Jun 18, 2001, 5:10 AM

Post #2 of 2 (381 views)
Re: Perl/MySQL script [In reply to] Can't Post

Got it, nevermind. :)


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives