Hi,

Someone please help me out that why my pagination page no 1, 2,3 ,. . .>> continued to the next line, is there any way to fix it in one line.

Here is my Script

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require("conn1.php"); ?>
</head>

<body>
  <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr align="center">
    <td height="10"><span class="pricestyle">
      
      <?php
		$strSQL = "SELECT * FROM pagin";
		$objQuery = mysql_query($strSQL);
		$Num_Rows = mysql_num_rows($objQuery);

		$Per_Page = 10;   // Per Page

		$Page = $_GET["Page"];
		if(!$_GET["Page"])
		{
			$Page=1;
		}

		$Prev_Page = $Page-1;
		$Next_Page = $Page+1;

		$Page_Start = (($Per_Page*$Page)-$Per_Page);
		if($Num_Rows<=$Per_Page)
		{
			$Num_Pages =1;
		}
		else if(($Num_Rows % $Per_Page)==0)
		{
			$Num_Pages =($Num_Rows/$Per_Page) ;
		}
		else
		{
			$Num_Pages =($Num_Rows/$Per_Page)+1;
			$Num_Pages = (int)$Num_Pages;
		}	
?>
        Total <?php echo $Num_Rows; ?> Record : <?php echo $Num_Pages;?> Page :
      
      <?php if($Prev_Page)
		{
			echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
		}

		for($i=1; $i<=$Num_Pages; $i++){
			if($i != $Page)
			{
				echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
			}
			else
			{
				echo "<b> $i </b>";
			}
		}
		if($Page!=$Num_Pages)
		{
			echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
		}
		?>
    </span></td>
  </tr>

</table>

<table width="500" border="0" align="center" cellpadding="12"  cellspacing="0">

<tr align="center">
  
  <?php
		$img = " SELECT * FROM pagin LIMIT $Page_Start , $Per_Page";
		//echo $img;
		$objQuery  = mysql_query($img);
		$intRows = 0;
		while($objResult = mysql_fetch_array($objQuery))
		{
		$intRows++;
	
?>
  
  <td width="17" height="62" align="center">
    <p><span class="tempinfo"><?php echo $objResult["sno"]; ?></span></td>
  
  
  <td width="547" align="left"><span class="tempinfo">Name: <?php echo $objResult["name"]; ?><br>
  Department: <?php echo $objResult["department"]; ?></span></td>
  <td width="34">&nbsp;</td>
  
  <?php if(($intRows)%2==0) { ?>	
  
</tr>
<?php }} ?>

</table>

<table width="500" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
		    <td height="21" class="pricestyle">
            Total <strong><?php echo $Num_Rows; ?></strong>
            Record : <strong><?php echo $Num_Pages;?></strong>
            Page :<strong>
			<?php if($Prev_Page)
		{
			echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
		}

		for($i=1; $i<=$Num_Pages; $i++){
			if($i != $Page)
			{
				echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
			}
			else
			{
				echo "<b> $i </b>";
			}
		}
		if($Page!=$Num_Pages)
		{
			echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
		}
		?>
      </strong></td>
</tr>
</table>
<?php mysql_close($conn); ?>
</body>
</html>

Recommended Answers

All 3 Replies

Member Avatar for diafol

Due to the width of the container? Have you looked at the underlying html?

I haven't read your code thoroughly but you seem to have this:

"Next>>"

Try changing all literal < and > to &lt; and &gt;

Hi Ardav,

Thank you for your reply, since I have only basic PHP knowledge I am wondering where to do this changes, But I believe I have to change the bottom part of script which is mentioned below for your reference.

Page No. Script STARTS

    <table width="500" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr align="center">
            <td height="21" class="pricestyle">
            Total <strong><?php echo $Num_Rows; ?></strong>
            Record : <strong><?php echo $Num_Pages;?></strong>
            Page :<strong>
            <?php if($Prev_Page)
        {
            echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> ";
        }

        for($i=1; $i<=$Num_Pages; $i++){
            if($i != $Page)
            {
                echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]";
            }
            else
            {
                echo "<b> $i </b>";
            }
        }
        if($Page!=$Num_Pages)
        {
            echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
        }
        ?>
      </strong></td>
</tr>
</table>

Page No. Script END

Member Avatar for diafol
echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> ";
echo " <a href ='{$_SERVER[SCRIPT_NAME]}?Page=$Next_Page'>Next&gt;&gt;</a> ";

All array items require braces {...} if they are contained within double quotes

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.