htmanning has asked for the wisdom of the Perl Monks concerning the following question:
$SQL = "Select * from database where active='yes' AND (TO_DAYS(NOW())- +TO_DAYS(dateadded) < 1)"; #check for records created today &Do_SQL; while ($pointer = $sth->fetchrow_hashref) { $jobtype = $pointer->{'jobtype'}; $toemail = $pointer->{'email'}; $SQL3 = "Select * from database where jobtype='$jobtype' A +ND active='yes' ORDER BY RAND() LIMIT 5"; &Do_SQL3; while ($pointer3 = $sth3->fetchrow_hashref) { $contact= $pointer3->{'contact'}; $jobnum= $pointer3->{'jobnum'}; $picture = $pointer3->{'picture'}; $my_job = "<tr><td style=\"width:60px;padding:0;\">$pictur +e - <a href=\"/get-job.pl?jobnum=$jobnum\">$contact</a></td></tr>"; } } open (MAILHTML, "|$sendmail $toemail") || die "Can't open $sendmail!\n +"; print MAILHTML "From: Admin <admin\@admin.com>\n"; print MAILHTML "Reply-to: Admin <admin\@admin.com>\n"; print MAILHTML "To: $toemail\n"; print MAILHTML "Subject: Recommended Jobs\n"; print MAILHTML "Content-Type: text/html\n"; print MAILHTML "$my_job"; close (MAILHTML);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: More loop issues
by morgon (Priest) on Jun 10, 2016 at 23:24 UTC | |
by htmanning (Friar) on Jun 10, 2016 at 23:49 UTC | |
|
Re: More loop issues
by stevieb (Canon) on Jun 10, 2016 at 23:27 UTC | |
|
Re: More loop issues (more well named subs that take args return values, less global vars, placeholders)
by Anonymous Monk on Jun 11, 2016 at 00:02 UTC | |
by stevieb (Canon) on Jun 11, 2016 at 01:46 UTC | |
|
Re: More loop issues
by $h4X4_|=73}{ (Monk) on Jun 11, 2016 at 09:20 UTC |