Hi guys, I am having severe trouble, maybe it is because I didn't get much sleep last night but I simply cannot see where I go wrong. Any of you have an idea?
I have a file with a few product numbers. I open the file and look the products up in my database. Sounds simple but I only get 1 recor as output?
Here is what I have, apart from a sour head;-)
070101-010
070102-010
070103-010
070104-010
070105-010
070106-010
070107-010
090118-010
# -----------------------------------------------------------
# Load file $ID.txt and generate error when missing
chdir "$Doc_Dir_01/temp";
if (!open(LIN, "$ID.txt")) {
$Err_Num = 1;
$Err_Mess = "Critical system error!<br>missing template '$ID.txt'";
}
else {
foreach $Line (<LIN>){
$Dbh = DBI->connect($DbConnectionInfo,$DbUserid,$DbPasswd);
$Sth = $Dbh->prepare("SELECT * FROM $DbTable WHERE Product_Num = '$Line'");
$Sth->execute();
$Result = $Sth->fetchrow_hashref();
$Product_Num = "$Result->{Product_Num}";
$Group_Num = "$Result->{Group_Num}";
$Product_Name_01 = "$Result->{Product_Name_01}";
$Product_Name_31 = "$Result->{Product_Name_31}";
$Size_X = "$Result->{Size_X}";
$Size_Y = "$Result->{Size_Y}";
$Size_Z = "$Result->{Size_Z}";
$Price_In = "$Result->{Price_In}";
$Price_Out = "$Result->{Price_Out}";
$Desc_01 = "$Result->{Desc_01}";
$Desc_31 = "$Result->{Desc_31}";
$Specs_01 = "$Result->{Specs_01}";
$Specs_31 = "$Result->{Specs_31}";
$Weight = "$Result->{Weight}";
$Company = "$Result->{Company}";
$PictRot = "$Result->{PictRot}";
$Rate = "$Result->{Rate}";
$Sth->finish();
$Dbh->disconnect;
print "$Line - $Product_Num - $Product_Name_31 - $Price_Out<br>";
}
close(LIN);
}
Cheers,
Ton