<center>
<input type="submit" name="limit" value=" Смотреть
">
</form>
</td>
</tr>
</table>
<?php
require "dbconnect.php";
if(isset($_POST['limit']))
{
$l1=$_POST['nomerP'];
echo "<div> Заявки на $l1 </div> ";
echo "<table border='0' cellpadding='50' bgcolor='#ffffff'>\n";
echo " <tr class='table'><th><center>Номер</th><th><center> Дата и время </th>
<th><center> Объект </th>
<th><center> Инцидент </th>
<th><center> Подробнее </th>
</tr>\n";
$l1=$_POST['nomerP'];
$limit1=mysql_query("select datez from zajavka where datez like '%$l1%'");
while($lim1_mas=mysql_fetch_row($limit1))
{
$res_id=mysql_query("SELECT `idz`, `datez`, namek, nameinz from zajavka, inz, kust where
`idkz`=idk and `idiz`=idinz and otm=1 and datez='$lim1_mas[0]'");
$a=1;
while($prise_mas=mysql_fetch_row($res_id))
{
$a=$a+1;
$chet=$a%2;
$ttt=date("Y-m-d", time());
$rest = substr("$ttt", 8,2);
$rest1 = substr("$prise_mas[1]", 8,2);
if ($rest1==$rest)
{
if ($chet==0)
{
$tab=table1;
}
else {
$tab=table2;
}
}
else
{
$tab=table3;
}
echo "<tr class='$tab'>
<td> $prise_mas[0] </td>
<td> $prise_mas[1] </td>
<td> $prise_mas[2]</td>
<td> $prise_mas[3] </td>
<td><form method='post' name='match' action='matchs1.php'>