Anyways that is the part that does not seem to be working. It actually works ok, but it's only showing 1 click and 1 impression when I've made sure there are at least 2 or 3 of each. Plus it either shows 1000%(did not work) or 0%.$sth = $dbh->prepare (qq{ SELECT * FROM table_name ORDER BY bid }) +; $sth->execute(); while ($row = $sth->fetchrow_hashref()) { $tracked_impressions = 0; $tracked_clicks = 0; $tracked_sales = 0; $sth1 = $dbh->prepare (qq{ SELECT * FROM aff_trac WHERE id = $ +aff_id AND bid = $row->{bid} AND t BETWEEN "$database_query_date_s" A +ND "$database_query_date_e" }); $sth1->execute(); while ($aff_row = $sth1->fetchrow_hashref()) { if ($aff_row->{utype} =~ /^i$/) { $tracked_impressions++; } elsif ($aff_row->{utype} =~ /^h$/) { $tracked_clicks++; } elsif($aff_row->{utype} =~ /^s$/) { $tracked_sales++; } } $html_content .= qq~ <tr valign="top"> <td align="center" class="header_cell"> Advertisement ID: $row->{bid} </td /> </tr /> <tr valign="middle"> <td align="center" class="non_label_cell"> <img src="$surl?pg=$in{pg}&do=$in{do}&action=show_imag +e&imgid=$row->{bid}" border="0" alt="Program ID $row->{bid}" /> </td /> </tr /> <tr valign="top"> <td align="left" class="non_label_cell"> <table class="non_label_cell" align="center" border="1 +" cellpadding="2" cellspacing="2" bordercolor="$Page_table_border_col +or" width="100%"> <tr valign="top"> <td align="left" class="label_cell"> <b>Impressions</b>: </td /> <td align="left" class="non_label_cell"> <b>$tracked_impressions</b> </td /> <td align="left" class="label_cell"> <b>Clicks</b>: </td /> <td align="left" class="non_label_cell"> <b>$tracked_clicks</b> </td /> <td align="left" class="label_cell"> <b>Click Through Rate</b>: </td /> <td align="left" class="non_label_cell"> <b>~; if ($tracked_click || $tracked_impressions) { $html_content .= ($tracked_click*1) / ($tracked_impressions*1) +; } else { $html_content .= "1000"; # Temp so I can see when it did NOT w +ork... or there was 0 to track... } $html_content .= qq~%</b> </td /> <td align="left" class="label_cell"> <b>Sales</b>: </td /> <td align="left" class="non_label_cell"> <b>$tracked_sales</b>: </td /> </tr /> </table /> </td /> </tr />\n~; } $dbh->disconnect();
In reply to Troubleshooting help... by powerhouse
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |