0

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; 
}
?>
2
Contributors
11
Replies
12
Views
5 Years
Discussion Span
Last Post by Stefano Mtangoo
0

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 ??

Edited by mehdi.yazdani: n/a

0

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 :)

0

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; 
}}
?>
0

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!

0

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 .

0

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>
0

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.

0

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?:(

0

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 .

Edited by mehdi.yazdani: n/a

0

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!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.