1. PHP / Говнокод #5043

    +157

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 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>';
    }

    Запостил: qbasic, 24 Декабря 2010

    Комментарии (1) RSS

    Добавить комментарий