I may be off on this, but this sounds like a sql issue. The record count
being returned is 0 so check on the record count, not if client eq null.
-Original Message-
From: FLAHERTY, JIM-CONT [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 20, 2002 10:55 AM
To: Beginners (E-mail)
Subject: perl DBI to Mysql , what happens when field I query is blank ?
Hello I have redhat 7.1 and mysql , I am trying to query DB of People
if there is no record for this person , I want to add them . My problem
seams to be what is in query results with it comes back blank
here is the code
$dbh1 =DBI ->connect($data_source, $username, $password) or die "cant
connect to
$data_source : my $dbh-> errstr\n";
my $sth1 = $dbh1 -> prepare("select owner from users where owner =
'$user_n'");
$sth1 -> execute or die " unable to execute query ";
# $sth1 -> finish;
# $dbh1->disconnect;
my $array_ref = $sth1 -> fetchall_arrayref();
foreach $row(@$array_ref){
my($owner) = @$row;
if($owner eq
L){
$dbh4 =DBI ->connect($data_source, $username, $password) or die "cant
connect to
$data_source : my $dbh-> errstr\n";
my $sth2 = $dbh4 -> prepare("insert into users(owner)values('$user_n')");
$sth2 -> execute or die " unable to execute query ";
}
}
$sth -> finish;
# look up results ??
thanks in advance
Jim
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]