Просмотр файла znak_otzuv(mysql)/letter2.php

Размер файла: 1.2Kb
<?php
require("db.php");
function print_data($komu_data,$page)
{
if(empty($page)) $page=0;

$query=mysql_query("SELECT `id` FROM `otziv` where komu='$komu_data';");

$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$mat_per_page=3;
$total_pages=ceil($total_mat_number/$mat_per_page);
$print = mysql_query("select * from `otziv` where komu='$komu_data' and id>0 order by id desc limit ".($mat_per_page).";");
while($data=mysql_fetch_array($print))

{
print "<small><u>&#1047;&#1072;&#1087;&#1080;&#1089;&#1082;&#1072; &#1086;&#1090;: ".$data['otkogo']."</u></small><br/>
<small><b> ".$data['message']."</b></small><br/>
<small><u>&#1044;&#1072;&#1090;&#1072;:</u> ".$data['data']."</small><br/>";
print "<small>*****</small><br/>";
//print "<small><u>&#1055;&#1088;&#1086;&#1075;&#1086;&#1083;&#1086;&#1089;&#1086;&#1074;&#1072;&#1083;&#1080;</u>: ".$data['counter']."</small><br/>";

} 

for ($i=0; $i<$total_pages; $i++){
$page_number=$i*$mat_per_page;
if ($page_number!=$page) {
print "<small><a href=\"letter.php?komu=$komu_data&amp;page=$page_number\">[&#1089;&#1090;&#1088;.".($i+1)."]</a></small>";
} else {
print "<small><b>&#1089;&#1090;&#1088;.".($i+1)."</b></small>"; }
}
}

?>