my guess: it seems that this is where the fault lies. But without information on how the database is setup and what $order_id is there is not much else that I can pick at.
$sql = "select * from product,order_line where prod_num = product_id and order_num = $order_id"; make sure your WHERE clause is correct in matching only the items related to the order. My guess: your SQL where clause is not complete/correct. > -----Original Message----- > From: Mark M. Andrich [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 02, 2002 4:01 PM > To: [EMAIL PROTECTED] > Subject: Beginner with a somewhat advanced question..... > > > Hi, > > > > I'm not sure if this question is appropriate for this list, > but I'll try > any way. I'm a total beginner who is trying to get some hands on > experience. I've read almost all of "Perl for Dummies" and am about to > move on to "Learning Perl". I've also got my "Perl in a Nutshell" > reference. I figure for this point I'm armed as well as could > be. Here's > my problem: > > > > My work has given me the following script to work on. It's > way beyond me > but I'm trying to pick it apart anyhow. This snippet of the larger > script is supposed to e-mail the customer a list of items that they've > purchased. However, it continues to pull all the items from > the database > that have ever been bought by anyone. They use this same > exact script on > another shopping cart and it works without issue. The following is the > pertinent part of the script. Please forgive me if this is > too heavy for > this list or if I should post elsewhere. If anyone could give me any > idea as to what part of the script might be the source of our problems > it would be greatly appreciated. I do have the complete script but was > concerned about posting the full thing here, since there's > CGI and HTML > code also. Thanks in advance: > > > > # Information Emailed to Customer > > $email_message = <<EOM; > > Thank you for your MyShop.com order. > > > > Your order confirmation number is #2002$Cust_ID. > > > > EOM > > ; > > $email_message .= > sprintf("%-25.25s%-20.20s%-3.3s%10.10s\n","Item","Cost","Qty", > "Amount"); > > $email_message .= "-"x58 . "\n"; > > > > $sql = "select * from product,order_line where prod_num = > product_id and > order_num = $order_id"; > > $rs = $DBObj->prepare($sql); > > $rs->execute(); > > > > while ($row = $rs->fetchrow_hashref()) { > > $quan=1; > > $email_message .= sprintf("%-25.25s%-20.20s%-3.3s%10.10s\n", > > $row->{p_product}, > > $row->{p_cost}, > > $quan, > > sprintf("%.2f",$quan*$row->{p_cost})); > > } > > > > $email_message .= sprintf("\nTotal%53.53s\n","USD $total_cost"); > > > > $email_message .= <<EOM; > > > > Please send any questions or comments to info\@Myshop.com > > > > We appreciate your business. > > Willy Waley > > EOM > > ; > > > > send_email(' My Shop <[EMAIL PROTECTED]>',$cu_email,'Your My Shop Digital > Receipt',$email_message); > > # End of Information Emailed to Customer > > > > > > ---------------------------------------------------------------------------- -------------------- The views and opinions expressed in this email message are the sender's own, and do not necessarily represent the views and opinions of Summit Systems Inc. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]