That would be it

-----Original Message-----
From: Tim Bunce [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 27, 2003 2:08 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: db to passwd comparison

On Thu, Mar 27, 2003 at 01:53:16PM -0500, [EMAIL PROTECTED] wrote:
> $sql->fetch_rowarray() returns a LIST. You are capturing the count of that
list.

Actully fetch_rowarray() returns just the first element when
called in a scalar context.

Perhaps the problem is that the statement returns more than
one row but only one is being fetched.

Tim.

> -----Original Message-----
> From: Rob [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, March 27, 2003 1:12 PM
> To: [EMAIL PROTECTED]
> Subject: db to passwd comparison
> 
> Hi, I'm trying to find out which users in a passwd file are not in a
> database.  What I've tried so far(see below) finds a few but misses even
> more.  I'm thinking it might be the way I'm preparing the statement or
> perhaps executing it?  Something else all together?  Any help appreciated.
> 
> <snip>
> $sql = $dbh->prepare_cached("SELECT CustNo, UserName FROM call_log WHERE
>     UserName = ?");
> 
> open(IN, "passwd") || die "Can't open passwd file:$!\n";
> open(OUT, ">usernames.db") || die "Can't create output file:$!\n";
> while(<IN>) {
>     chomp;
>     ($userP, $group) = (split /:/)[0,3];
>     $grps{$group}++;
>     $sql->execute($userP)
>             or warn "Can't execute select " . $sql->errstr;
>     $userD = $sql->fetchrow_array();
>     if($userD eq "") {
>         print OUT "UserP:$userP - UserD:$userD\n";
>     }
>     $sql->finish;
> }
> close(OUT);
> close(IN);
> </snip>
> 
> Thanks,
> --
> Rob
> 

Reply via email to