FROM dokument, resnach
WHERE archiv =0
AND STATUS =2
AND idisp =0
OR idisp ='{$_SESSION['nach1']}'
AND idd = iddr
and rnp=0
");
while($sod_mas1=mysql_fetch_row($sod1))
{
$kolvo=$sod_mas1[0];
}
if ($kolvo>0)
{
echo "<table border='0' align='center' width='900'><tr><td class='table1'> Всего документов на
контроле <b>$kolvo</b></td></tr> </table>\n";
echo "<table border='0' align='center'>\n";
echo "<tr class='tr'><th> №
</th><th> Дата
регистрации </th>
<th> Наименование </th>
<th> Адресат </th>
<th> Резолюция начальника </th>
<th> Дата </th>
<th> Резолюция </th>
<th> Ок </th>
</tr>\n";
$sod=mysql_query("
SELECT idd, datez, named, otkuda, link, resn, datern
FROM dokument, resnach
WHERE idkd =3 and archiv=0 and status=0 and idisp=0 or idisp='{$_SESSION['nach1']}' and
idd=iddr and rnp=0
");
while($sod_mas=mysql_fetch_row($sod))