Здравейте на всички,имам една задача която за съжаление е непосилна за мен.
Значи използвам ето този код за да си станицирам една таблица
И всичко си работи ок но искам да го направя по следния начин от този урок
http://videotutorials-bg.com/lessons.php?action=viewsub&id=27&t=474&page=2%D0%B0&PHPSESSID=5a4b2fbbe45af46ab6cda5057f8f86f5
Много ви моля помогнете ми.
Значи използвам ето този код за да си станицирам една таблица
Код:
<?php include ("conf.php"); ?>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251" />
<?php
if(!isset($_GET['page']))
{
$page = 1;
}
else {
$page = $_GET['page'];
}
$max_results = 10;
$from = (($page * $max_results) - $max_results);
$db = mysql_query("SELECT * FROM users ORDER BY points DESC LIMIT $from,$max_results") or die(mysql_error());
echo "<div id='mem'>
<table style='font-family: Tahoma; font-size: 11px; font-weight: bold;'>
<tr><td><div>Потребители с точки по малко от 30 се оцветяват в - <font color='#ff1d1d'>Червено</font></td></tr>
<tr><td><div>Потребители с точки над 30 се оцветяват в - <font color='#27e302'>Зелено</font></td></tr>
<tr><td><div>Потребители с точки над 300 се оцветяват в - <font color='#f7941d'>Оранжево</font></td></tr>
</table>
<br />
</div>
";
echo "<table style='font-family: Tahoma; font-size: 13px; font-weight: bold;'><tr>
<td style='width: 133px; height: 21px; background: url(img/overuser.png) no-repeat; text-align: center;'>Потребител</td>
<td style='width: 133px; height: 21px; background: url(img/overuser.png) no-repeat; text-align: center;'>Точки</td>
<td style='width: 133px; height: 21px; background: url(img/overuser.png) no-repeat; text-align: center;'>Верни отговори</td>
<td style='width: 133px; height: 21px; background: url(img/overuser.png) no-repeat; text-align: center;'>Грешни отговори</td>
<td style='width: 133px; height: 21px; background: url(img/overuser.png) no-repeat; text-align: center;'>Неотг. въпроси</td></tr>";
while($row = mysql_fetch_array($db))
{
$user = $row['username'];
$points = $row['points'];
$verni = $row['verni'];
$greshni = $row['greshni'];
$neotg = $row['neotg'];
if ($points < 30)
{
$user="<font color='#ff1d1d'>$row[username]</font> ";
}
elseif ($points > 300)
{
$user="<font color='#f7941d'>$row[username]</font>";
}
elseif ($points < 300)
{
$user="<font color='#27e302'>$row[username]</font>";
}
echo "
<tr><td style='width: 133px; height: 21px; background: url(img/users.png) no-repeat; text-align: center;'>$user</td>
<td style='width: 133px; height: 21px; background: url(img/users.png) no-repeat; text-align: center;'>$points</td>
<td style='width: 133px; height: 21px; background: url(img/users.png) no-repeat; text-align: center;'>$verni</td>
<td style='width: 133px; height: 21px; background: url(img/users.png) no-repeat; text-align: center;'>$greshni</td>
<td style='width: 133px; height: 21px; background: url(img/users.png) no-repeat; text-align: center;'>$neotg</td></tr>
";
}
echo "</table>";
$i++;
if($i > 1)
{
echo"</tr><tr>";$i = "0";
}
echo"</tr></table></tr></td></table>";
echo "<br>";
echo "<b>Страници: ";
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM users"),0);
$total_pages = ceil($total_results / $max_results);
if($page > 1){
$prev = ($page - 1);
echo "<a id=\"stranici\" href=\"".$_SERVER['PHP_SELF']."?page=$prev\"></a>";
}
for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "$i ";
} else {
echo "<a id=\"stranici1\" href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
if($page < $total_pages){
$next = ($page + 1);
echo "<a id=\"stranici\" href=\"".$_SERVER['PHP_SELF']."?page=$next\"></a></b>";
}
?>
И всичко си работи ок но искам да го направя по следния начин от този урок
http://videotutorials-bg.com/lessons.php?action=viewsub&id=27&t=474&page=2%D0%B0&PHPSESSID=5a4b2fbbe45af46ab6cda5057f8f86f5
Много ви моля помогнете ми.