- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
$count_per_page = 15;
$page = 1;
mysql_select_db($DB);
$result = mysql_query('SELECT round(count(id)/' . $count_per_page . ') FROM PRICELIST');
$counts = mysql_fetch_row($result);
$page_max = $counts[0];
if (!empty($_GET['page'])) {
$page = (int) $_GET['page'];
if ($page > $page_max)
$page = $page_max;
if ($page < 1)
$page = 1;
}
$result=mysql_query('SELECT SQL_CALC_FOUND_ROWS * from PRICELIST LIMIT ' .(($page - 1) * $count_per_page). ', ' .$count_per_page );
$cnt = mysql_result(mysql_query('SELECT FOUND_ROWS()'), 0);
if(mysql_num_rows($result)) { // выводим таблицу
echo "<td valign='right width='12%' height='15px' align='center' bgcolor=#FFFFFF>Артикул</td>
<td valign='right width='58%' height='' align='center' bgcolor=#FFFFFF>Наименование изделий</td>
<td valign='right width='10%' height='' align='center' bgcolor=#FFFFFF>Страна</td>
<td valign='right width='10%' height='' align='center' bgcolor=#FFFFFF>Ед</td>
<td valign='right width='15%' height='' align='center' bgcolor=#FFFFFF>Цена</td>
<td valign='right width='5%' height='' align='center' bgcolor=#FFFFFF>картинка</td>";
while($row = mysql_fetch_assoc($result)) {
echo "</tr>";
echo "<tr>";
echo '<td align=left width=12% height=10% bgcolor=#FFFFFF>'.$row['artikul'].'</td><td width=48% align=left bgcolor=#FFFFFF height=30px>'.$row['nametovar'].'</td><td width=15% align=left bgcolor=#FFFFFF height=10px>'.$row['country'].'</td><td width=10% align=left bgcolor=#FFFFFF height=10px>'.$row['edin'].'</td><td width=10% align=left bgcolor=#FFFFFF height=10px>'.$row['cena'].'</td><td width=5% align=left bgcolor=#FFFFFF height=5px><a id="example1" href="kartinki/' . $row['image'] .'"><img src="kartinki/' . $row['image'] .'" width=75px height=75px></a></td>';
}
echo '</tr></table><table height=1% width=100%><tr><td align="center" colspan="5" bgcolor=#FFFFFF>';
echo $i;
for ($i=1; $i<=$page_max; ++$i) {
if ($i != $page) {
echo '<a href="?page='.$i.'"><font color=#1007b8>'.$i.'</font></a> ';
}
else {
echo '<font color=#e59001>'.$i.' </font>';
}
}
echo '<h5 align=center><font color=#e59001>Всего в прайс-листе '. $cnt .' позиций</font></h5>';
}
Lure Of Chaos 25.12.2010 13:42 # 0