да полно здесь переменных.
Ничего страшного если весь код напишу?
-~{}~ 22.06.06 16:44:
$message="";
$firms=0;
$rubs=0;
$mtn_quots_arr=array();
$mtn_quots_list=" ";
for ($i=0; $i<$rows; )
{
$firm_id=pg_result($res,$i,'firm_id');
$firm_schedule=pg_result($res,$i,'quot_notificator_schedule');
$rub_id=pg_result($res,$i,'rubric_id');
$item_name=pg_result($res,$i,'name');
$item_qty=pg_result($res,$i,'qty');
$item_unit=pg_result($res,$i,'unit');
$item_delivery_place=pg_result($res,$i,'delivery_place');
$item_id=pg_result($res,$i,'id');
$item_quot_id=pg_result($res,$i,'quot_id');
$item_comment = pg_result($res,$i,'comment');
$item_customer_id = pg_result($res, $i, 'customer_id');
$item_customer_name = pg_result($res, $i, 'r_name');
$mtn_quots_arr[$item_quot_id]=1;
//$mtn_quots_list.=$item_quot_id." ";
if($prev_rub!=$rub_id)
{
$res0=pg_exec($conn,"SELECT code, name FROM rubrics WHERE id=$rub_id");
$message.="<TR><TD colspan=6>Ðóáðèêà: <a href=\"$SetHost/members/quot_prices/?rubric_id=$rub_id\">".pg_result($res0,0,'code')." - ".pg_result($res0,0,'name')."</a></TD></TR>\n";
pg_freeresult($res0);
$rubs++;
}
$message.="<TR><TD><A HREF=\"$SetHost/members/quot_prices/quot?qid=$item_quot_id\">$item_quot_id</a></TD><TD><A href=\"$SetHost/showfirm?firm_id=$item_customer_id\">$item_customer_name</A></TD><TD><A HREF=\"$SetHost/members/quot_prices/editpage/create/?qid=$item_quot_id&oid=$item_id\">$item_name</A></TD><TD>$item_qty $item_unit</TD><TD>$item_comment</TD><TD>$item_delivery_place</TD></TR>\n";
$prev_rub=$rub_id;
$i++;
if ($i==$rows || pg_result($res,$i,'firm_id')!=$firm_id)
{
if (strpos($firm_schedule,$the_hour)==0)
$hours = "íà $the_hour:00";
else
{
$prev_hour = substr($firm_schedule,strpos($firm_schedule,$the_hour)-3,2);
$hours = "ñ $prev_hour:00 ïî $the_hour:00";
}
eval("\$first = \"$header\";");
$message = $first.$message."</TABLE>$footer</BODY></HTML>";
-~{}~ 22.06.06 16:45:
$mtn_keys=array_keys($mtn_quots_arr);
for ($mtn_i=0; $mtn_i<count($mtn_keys); $mtn_i++){
$mtn_quots_list.=$mtn_keys[$mtn_i]." ";
} //for
mtn_insert_mail_report_line("
[email protected]", $firm_email, "
[email protected]", "Óâåäîìëåíèå î çàïðîñàõ êîòèðîâîê öåí â ÑÝÒ ".$mtn_quots_list, "t", "", "", "");
$mtn_quots_list=" ";
$mtn_quots_arr=array();
///
pg_freeresult($res0);
$res0=pg_exec($conn,"DELETE FROM quot_note WHERE firm_id=$firm_id");
if (!$res0 || pg_cmdtuples($res0)==0)
echo "? an error in deleting from quot_note where firm_id=$firm_id\n";
pg_freeresult($res0);
$firms++;
$message="";
$prev_rub=0;
}
}
echo "OK - notifications sent to $firms firms (total $rubs rubricsXfirms)\n";
-~{}~ 22.06.06 16:48:
$header='<HTML><BODY>
<center><b>Óâåäîìëåíèå î çàïðîñå(àõ

êîòèðîâîê öåí â ÑÝÒ<b></center><br>\n
$the_date $hours â ñèñòåìó ýëåêòðîííîé òîðãîâëè ïî ðóáðèêàì,
íà êîòîðûå âû ïîäïèñàíû, ïîñòóïèëè çàïðîñû íà ñëåäóþùóþ ïðîäóêöèþ:<br>\n
<TABLE width=98% align=center border=1 cellspacing=0 cellpadding=3 bordercolor=\'#666666\'>
<TR><TD>Íîìåð êîòèðîâêè</TD><TD>Çàêàç÷èê</TD><TD>Íàèìåíîâàíèå</TD><TD>Êîë-âî</TD><TD>Òðåáîâàíèÿ, ïðåäúÿâëÿåìûå ê ïðîäóêöèè</TD><TD>Ìåñòî äîñòàâêè</TD></TR>\n';