Hi, i created the page which is display some information from database with some rules in the end of page i putted the command that it is show how many page that i have.

so, i decide to add next and previous in the sides of page numbers and also i wanna mark active page for visitor (for ex : type active page with bold style)

here is the code :

<?php 
include "db.php";
 
//Rows
$qtyRow = '<tr>';
$priceRow = '<tr>';
 
$nn=6; //Number of items, we split this later
 
$s=mysql_query("SELECT * FROM `test1`");
 
$c=mysql_num_rows($s);
 
if($c%$nn==0){
	$cc=$c/$nn;	
}else{
	$cc=$c/$nn+1;	
}
 
//$cc : Number of pages
 
$ss=@$_REQUEST['ss']; //Start position (eg: 6)
$other_tables = "";
 
if($ss=="" || $ss==null){
	$ss = 0; //Set to zero because it is incremented later
}
 
//Pages
echo "<table border=\"1\" align=\"center\">";
$sql=mysql_query("SELECT * FROM `test1` ORDER BY `id` DESC LIMIT $ss,$nn");
$inc = 0;
while($r=mysql_fetch_array($sql)){
	$id=$r['id'];  
	$name=$r['name'];
	if($inc == 0){
		$qtyRow .= "<tr>";
		$priceRow .= "<tr>";
	}
	$qtyRow .= "<td>$id</td>";
	$priceRow .= "<td>$name</td>";
	++$inc;
	if($inc == 3 || $inc == 6 || $inc == mysql_num_rows($sql)){
		//Display Table
		echo $qtyRow."</tr>";
		echo $priceRow."</tr>";
		echo "</table>";
 
		//To remove extra table
		if(mysql_num_rows($sql) <= 3){
			$inc = 7;
		}
 
		//Reset
		if($inc == 3){
			echo "<br><table border='1' align='center'>";
			$qtyRow = "<tr>";
			$priceRow = "<tr>";
		}
	}
}
echo "</table>";
$j=0;
echo"page : ";
for($i=1;$i<=$cc;$i++){
	echo"<a href=\"select.php?ss=$j\">$i</a>";
	echo"|";
	$j=$j+$nn; 
}
?>

thanks my friend but unfortunately i couldn't assemble that code in my page !
i liked that style, so how can i edit my codes to reach that style ??
could yo help me with this problem ??

thanks my friend but unfortunately i couldn't assemble that code in my page !
i liked that style, so how can i edit my codes to reach that style ??
could yo help me with this problem ??

follow the tutorial and forget your code for a while. Once you finish the tut. and know how things works, you can accomodate changes and additions to fit your needs. That is the way we learn :)

please help me to set active button for active page. page that you are in it.
and other style for other pages, page that you are not.

<?php
$j=0;
	
for($i=1;$i<=$cc;$i++)
{
	?> <li><a class="button active small" href="showcodes.php<? echo "?ss=$j"; ?>"><span><? echo"$i"; ?></span></a></li>
       <li><a class="button tertiary small" href="showcodes.php<? echo "?ss=$j"; ?>"><span><? echo"$i"; ?></span></a></li>
    
     <? 
	
	$j=$j+$nn; 
}}
?>

please help me to set active button for active page. page that you are in it.
and other style for other pages, page that you are not.

<?php
$j=0;
	
for($i=1;$i<=$cc;$i++)
{
	?> <li><a class="button active small" href="showcodes.php<? echo "?ss=$j"; ?>"><span><? echo"$i"; ?></span></a></li>
       <li><a class="button tertiary small" href="showcodes.php<? echo "?ss=$j"; ?>"><span><? echo"$i"; ?></span></a></li>
    
     <? 
	
	$j=$j+$nn; 
}}
?>

You mean styling the button? That is CSS and differs from person to person!

No, u know in this form i have 2 style for my buttons one of them is active style i want to set active style for page that i already visiting it.

<li><a class="button active small" href="showcodes.php<? echo "?ss=$j"; ?>"><span><? echo"$i"; ?></span></a></li>

this is the style which used for active button .

its CSS issue try and adapt this code to your need

<style>
.button_active_small{
    font-weight:bold;
    text-decoration: none;
    color:maroon;
    border:1px;
}
</style>

<?php $j=23; $i=100; ?>
 <a class="button_active_small" href="<?php echo 'showcodes.php?ss='.$j; ?>"><?php echo $i; ?> </a>

My dear i create css style i dont need to add any styles
Please answer my question it is not about creating any styles
As i said i create 2 style for my buttons class="button_active_small" style and class="button tertiary small" so, now i want to set first style for page that i already visiting it that with FOR LOOP COMMAND created and the other style for other pages.

My dear i create css style i dont need to add any styles
Please answer my question it is not about creating any styles
As i said i create 2 style for my buttons class="button_active_small" style and class="button tertiary small" so, now i want to set first style for page that i already visiting it that with FOR LOOP COMMAND created and the other style for other pages.

do you pay me for anything I contribute?:(

if you cant answer or you dont know what to do you can say i dont have any idea about that and dont ever never waste your and any body's time .

if you cant answer or you dont know what to do you can say i dont have any idea about that and dont ever never waste your and any body's time .

I'm off the bandwagon!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.