странициране добавка

vankata

Registered
$page=(int)$_GET['page'];
if($page == NULL || $page <= 0)
{
$page = 1;
}
$pp = 10;
$start = ($page*$pp) - $pp;
$query = run_q("SELECT * FROM `home`.`ip`");
$broi = mysql_numrows($query);
$total = ceil($broi/$pp);
$sql=run_q("SELECT * FROM `home`.`ip` ORDER BY time DESC LIMIT $start,$pp ");


$prev = $page - 1;
$next = $page + 1;
if($page == 1) {
echo "";
}
else
{
echo "<a href='?page=$prev'>Предишна</a>";
}

if($page >= $total) {
echo "";
}
else
{
echo "<a href='?page=$next'>Следваща</a>";
}


така ми излизат само линкове за

Предишна & Следваща..
как да си направя заявката да излиза
Страници: 1 2 3 4 5 6 7
 
Код:
<?php
echo "<table align='center' class='lesson'>";
include_once ("blocks/bd.php");
$table = "p_e_bylgaria";
if(!isset($_GET['page'])){ $page = 1; } else { $page = $_GET['page']; }
echo "<center><br>";
$max_results = 5;
$from = (($page * $max_results) - $max_results);

$i="0";
$nared="3";

$result = mysql_query ("SELECT * FROM $table ORDER BY id DESC LIMIT $from, $max_results",$db) or die ("<p>Не може да се свърже с базата данни</p>");
while ($myrow = mysql_fetch_array ($result))
{
	$id = $myrow[id];
	$title = $myrow[title];
	$days = $myrow[days];
	$dates = $myrow[dates];
	$price = $myrow[price];
	$author = $myrow[author];
	$description = $myrow[description];
	$poster = $myrow[poster];
	
		$i++;
	}
	
$zapis = mysql_num_rows($result);
	
$width=ceil(100/$nared);

if($zapis != 0) {
do { printf ("
	   <td class='lesson_title' valign=\'top\' width=\''.$width.'%\'>
       <p class='lesson_name'><a href='vij_bg.php?id=%s'><img class='mini_poster' align='left' src=\"./images/$myrow[poster]\"></a><a href='vij_bg.php?id=%s' >%s</a></p>
       <p class='lesson_adds'>Дни: <font color='#53a961'>%s</font></p>
       <p class='lesson_adds'>Дати: <font color='#FF0000'>%s</font></p>
       <p class='lesson_adds'>Цена: <font color='#53a961'>%s</font></p>
       <p class='lesson_adds'>Автор: <font color='#8AA3E1'>%s</font></p></td>
         </tr>
         
       <tr>
         <td colspan='2'><p>%s</p></td>", $myrow["id"], $myrow["id"], $myrow["title"],$myrow["days"], $myrow["dates"], $myrow["price"],$myrow["author"],$myrow["description"], $myrow["poster"] );
if ($i==$nared) 
{
echo "</tr>
<tr>";
$i=0;
}
}
while ($myrow = mysql_fetch_array ($result));
}




echo "<p class='paging'>";
// стоп
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM $table"),0);
$total_pages = ceil($total_results / $max_results);
if($page > 1){
$prev = ($page - 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$prev\" class=\"paging\">Предишна</a> ";
}

for($i = 1; $i <= $total_pages; $i++){
if(($page) == $i){
echo "<b>$i</b> ";
} else {
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i</a> ";
}
}
if($page < $total_pages){
$next = ($page + 1);
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$next\" class=\"paging\">Следваща</a>";
echo "</p><br>";
}
echo "</table>";
?>
 
Аз исползвам нещо лесно да ми добавя нещо в страницата когато отворя някаф си линк


Код:
<?
if($_GET['Нещо'] == 'Нещо2'){
echo "<br><center><b>Текст</b></center><br>";
}
?>

и то излиза http://localhost/index.php?Нещо?=Нещо2
доста ми помага на мен специално :)
 

Горе