Ответов: 5 Просмотров: 61
|
PHP:
скопировать код в буфер обмена
include ("mysql.php"); if (isset($_GET['search'])) $search = $_GET['search']; $s_section = $_GET ['section']; $s_type = $_GET ['type']; $query1 = mysql_query ("SELECT section, type, text, name, email, date FROM announcements WHERE section = '$s_section' AND type = '$s_type' and text LIKE '%$search%'"); if(!isset($_GET['page'])) $page = 1; else $page = ($_GET['page']); $on_page = 10; $begin = ($page - 1) * $on_page; $num_pages = ceil ($allnum / $on_page); $query = mysql_query ("SELECT section, type, text, name, email, date FROM announcements WHERE section = '$s_section' and type = '$s_type' and text LIKE '%$search%' LIMIT $begin, $on_page"); <table width='300' border ='1' > <tr> <td width='150'>$type</td><td><div align='right'>$date</div></td> </tr> </table> <table width='300' border ='1'> <tr> <td>$text</td> </tr> </table> <table width='300' border ='1'> <tr> <td width='150'>$name</td> <td><div align='right'><a href='mailto:$email'>$email</div></td> </tr> </table> <br>} for($i = 0; $i < $num_pages; $i++) { $pages = $i+1; echo "<a href=?page=$pages§ion=$s_section&type=$s_type&search=".urlencode($search).">$pages</a> "; }
почитайте о стиля программирования в книжках, почитайте о templates (разделение логика и дизайна)
(Добавление)
теперь я понимаю почему у вас не отформатирован код по пробелам, тут это тупо не поддерживается=) |