I have a delima I want to add records to a table in mysql , only if that
record isnt there , Help
Code
my $sth1 = $dbh -> prepare("select distinct testname from testhistory");
$sth1 -> execute or die " unable to execute query ";
#$sth1 -> finish;
my $array_ref1 = $sth1->fetchall_arrayref();
foreach $row(@$array_ref1) {
my($tname) = @$row;
my $sth5 = $dbh-> prepare("select testname from phistory");
$sth5 -> execute or die " unable to execute query ";
#$sth1 -> finish;
my $array_ref5 = $sth5->fetchall_arrayref();
foreach $row1(@$array_ref5) {
my($tname) = @$row1;
if ($tname ne ""){
my $sth2 = $dbh -> prepare("insert into
phistory(testname)values('$tname')");
$sth2 -> execute or die " unable to execute query ";
#$sth1 -> finish;
}
}
this code doesnt add at all
Thanks
Jim