<?php
include ("txt/header.php");
?> 
<table width="560" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td height="22" class="menu">
<div align="center" title="hope-auction">
Последние изменения на сайте
</div>
</td>
</tr>
<tr> 
<td align="center" valign="top" class="menu"><table width="560" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="center" valign="top" bgcolor="#FFFFFF"><table width="550" border="0" cellspacing="5" cellpadding="0">
<tr> 
<td>
<center><b>Свежие товары:</b><br><br>
<table border=0><tr bgcolor=white>
<?php
$nowtime=time();
$query="select first,name,price,parent,begin from goods where (srok>$nowtime and quantity>0) order by begin desc";
$res=mysql_query($query);
$number_of_rows=mysql_num_rows($res);
$num=3;
if ($number_of_rows<3) {
$num=$number_of_rows;
}
for ($i=0;$i<$num;$i++) {
$row=mysql_fetch_assoc($res);
$name=$row["name"];
$name=substr($name,0,20);
$name=$name."...";
$price=$row["price"];
$cat=$row["parent"];
$query="select name from subcategories where (first='$cat')";
$cats=mysql_query($query);
$rowcats=mysql_fetch_assoc($cats);
$name_of_category=$rowcats["name"];
$id=$row["first"];
echo "<td><table class='t' border=0>";
echo "<tr bgcolor=white><td><center>Название:</td></tr>";
echo "<tr bgcolor=white><td><center><a href=\"commodity.php?com=$id\"><u>$name</u></a></td></tr>";
echo "<tr bgcolor=white><td><center>Начальная цена:</td></tr>";
echo "<tr bgcolor=white><td><center>$price</td></tr>";
echo "<tr bgcolor=white><td><center>Категория:</td></tr>";
echo "<tr bgcolor=white><td><center><a href=\"goods.php?subcat=$cat\"><u>$name_of_category</u></a></td></tr>";
echo "</table></td>";
}
?>


</tr></table>
<?php
if ($num==0) {
echo "<center>Свежих товаров пока нет</center>";
}
?>

<br>
<b>Горячие лоты:</b><br><br>
<table border=0><tr bgcolor=white>
<?php
$nowtime=time();
$query="select first,name,price,parent,begin from goods where (srok>$nowtime and quantity>0) order by srok asc";
$res=mysql_query($query);
$number_of_rows=mysql_num_rows($res);
$num=3;
if ($number_of_rows<3) {
$num=$number_of_rows;
}
for ($i=0;$i<$num;$i++) {
$row=mysql_fetch_assoc($res);
$name=$row["name"];
$name=substr($name,0,20);
$name=$name."...";
$price=$row["price"];
$cat=$row["parent"];
$query="select name from subcategories where (first='$cat')";
$cats=mysql_query($query);
$rowcats=mysql_fetch_assoc($cats);
$name_of_category=$rowcats["name"];
$id=$row["first"];
echo "<td><table class='t' border=0>";
echo "<tr bgcolor=white><td><center>Название:</td></tr>";
echo "<tr bgcolor=white><td><center><a href=\"commodity.php?com=$id\"><u>$name</u></a></td></tr>";
echo "<tr bgcolor=white><td><center>Начальная цена:</td></tr>";
echo "<tr bgcolor=white><td><center>$price</td></tr>";
echo "<tr bgcolor=white><td><center>Категория:</td></tr>";
echo "<tr bgcolor=white><td><center><a href=\"goods.php?subcat=$cat\"><u>$name_of_category</u></a></td></tr>";
echo "</table></td>";
}
?>

</tr></table>
<?php
if ($num==0) {
echo "<center>Горячих товаров пока нет</center>";
}
?>
</td>
</tr>
</table></td>
</tr>
</table></td></tr></table>
<br>
</td>
</tr>
</table></td>
</tr>
<?php
include ("txt/footer.php");
?> 

