Gossamer Forum
Home : General : Perl Programming :

Combining While Statements

Quote Reply
Combining While Statements
Hi All,

I have the following code in a script. and im trying to print the renewal date $renewdate, but to do this i have combined the while statements. it prints the page but with no info.

If i # the second while statement, it prints all the info but not including the $renewdate (obviousley)

Is the syntax correct for the while statements, and or can i combine the queries into one, (i've tried to combine but always get a 500 error)

################ getting next url according to the action type ###########
my ($query,$frm_action,$head_msg,$input_field,$select_name);
if($action_type eq "list_all_dm")
{
$query = qq{select * from order_d,order_m where order_m.order_id=order_d.order_id and order_m.user_id=$user_id and order_d.domain_reg="y" order by order_m.order_id };
$head_msg = "<br><br><font face=$normal_font_style size=$normal_font_size>Below is a list of all your Registered Domain Names.</font><br><br>";
}


################ end of getting next url according to the action type ###########

######### getting renew_mails_tp from conf_table ############
my $query_conf = qq{select renew_mails_tp from conf_table };
my $ret_mysql_conf = select_query($query_conf);
my @queryresult_conf = $ret_mysql_conf->fetchrow_array();
######### end of getting renew_mails_tp from conf_table ############


############ getting all the registered domains whose days left from expiration=renew_mails_tp in table order_d ##############
my $query_domain = qq{select * from order_d, order_m where DATE_SUB(domain_date,INTERVAL $queryresult_conf[0] DAY) <= DATE_SUB(curdate(),INTERVAL domain_period_yr YEAR) and order_m.order_id=order_d.order_id and order_m.user_id=$user_id and domain_reg="y" };
#print "query_domain = " . $query_domain . "<br>";
my $ret_mysql_domain = select_query($query_domain);
my $numrows_domain = $ret_mysql_domain->rows;
my @queryresult_domain;
############ end of getting all the registered domains whose days left from expiration=renew_mails_tp in table order_d ##############



############ getting all the domains returned by the query ##############
my $ret_mysql = select_query($query);
my $numrows = $ret_mysql->rows;
my @queryresult;
if($numrows < 1)
{
print "<font face=$normal_font_style size=$normal_font_size>There are no Registered Domains.</font><br><br>";
footer();
exit;
}
############ getting all the domains returned by the query ##############


print $head_msg;
print "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr>";


print "<td class='tblhead' width='20%'>Domain Name</td>";
print "<td class='tblhead' width='20%'>Registered On</td>";
print "<td class='tblhead' width='20%'>For Years</td>";
print "<td class='tblhead' width='20%'>Renewal Date</td>";
print "<td class='tblhead' width='20%'>Hosting Plan</td>";
print "</tr>";


while (@queryresult = $ret_mysql->fetchrow_array())
{
while (@queryresult_domain = $ret_mysql_domain->fetchrow_array())
{
print "<tr>";
my $dm = getDomain($queryresult[3]);
my $newdate = &_unix_to_link_date($queryresult[6]);
my $pl_name = getPlanName($queryresult[7]);
my $renewdate = getDomainRenewalDate($queryresult_domain[6]);
{
print "<td align=left>$queryresult[2]$dm</td>";
print "<td align=left>$newdate</td>";
print "<td align=left>$queryresult[4]</td>";
print "<td align=left>$renewdate</td>";
print "<td align=left>$pl_name</td>";
}
print "</tr>";


}#end of while
}##end of second while


print "</table>";


Regards

Mark
http://www.host4.me.uk

No doubt i'll be back for more answers!
Subject Author Views Date
Thread Combining While Statements mdj1 6252 Jul 31, 2003, 12:10 AM
Thread Re: [mdj1] Combining While Statements
Andy 6218 Jul 31, 2003, 1:40 AM
Post Re: [Andy] Combining While Statements
mdj1 6178 Jul 31, 2003, 2:05 AM
Thread Re: [mdj1] Combining While Statements
mdj1 6147 Aug 1, 2003, 9:21 PM
Thread Re: [mdj1] Combining While Statements
Stealth 6134 Aug 1, 2003, 10:30 PM
Post Re: [Stealth] Combining While Statements
mdj1 6138 Aug 1, 2003, 10:42 PM