0

Hi, I am showing my output using this.
It shows all the records on web page where month is July(07)
But I want it show all the records like: there are 29 records found, I also need 3 records per page, How I will do paging for these. please guide me.

<?php
$con = mysql_connect("localhost","root","root");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

$a= $_POST["a"];
mysql_select_db("onm", $con);

$result = mysql_query("SELECT * FROM leaseentry  WHERE LAPeriodEnd like '%-07-%'");


while($row = mysql_fetch_array($result))
  {
  echo "<table cellpadding=2 cellspacing=2 width=100%>
<tr>


</tr>";
  echo "<tr>";
  echo "<th bgcolor=#FFCC00 width=300px>SiteID</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['SiteId'] . "</td>";
    echo "</tr>";
  echo "<tr>";
						
  echo "<th bgcolor=#FFCC00>Owner Name</th>";
  echo "<td bgcolor=#FEE9A9>" . $row['OwnerName'] . "</td>";
  
    echo "</tr>";
	
	echo "<tr>";
	echo "<th bgcolor=#FFCC00>Lease Agreement</th>";
	 echo "<td bgcolor=#9BCB5D><a href=".$row['LA'].">".$row['ch']."</a></td>";
	  

	  echo "</tr>";
	  
	
	
	echo "<tr>";
  echo "<th bgcolor=#FFCC00>LA Start Date</th>";
  echo "<td bgcolor=#FEE9A9>" .date("j-F-Y",strtotime($row['LAPeriodStart'])). "</td>";
    echo "</tr>";
	
	echo "<tr>";
  echo "<th bgcolor=#FFCC00>LA End Date</th>";
  echo "<td bgcolor=#FEE9A9>" .date("j-F-Y",strtotime($row['LAPeriodEnd'])). "</td>";
    echo "</tr>";
	
	  echo "<tr>";
	echo "<th bgcolor=#FFCC00>Purchase Order</th>";
	 echo "<td bgcolor=#CB9B5D><a href=".$row['PO'].">".$row['ch']."</a></td>";

	  echo "</tr>";
	  
	
	 echo "<tr>";
  echo "<th bgcolor=#FFCC00>PO Start Date/th>";
  echo "<td bgcolor=#FEE9A9>" .date("j-F-Y",strtotime($row['POStartDate'])). "</td>";
    echo "</tr>";
	
	 echo "<tr>";
  echo "<th bgcolor=#FFCC00>PO End Date</th>";
  echo "<td bgcolor=#FEE9A9>" .date("j-F-Y",strtotime($row['POEndDate']))  . "</td>";
    echo "</tr>";
	

	  echo "<tr>";
	echo "<th bgcolor=#FFCC00>SPA</th>";
	 echo "<td bgcolor=#CB9B5D><a href=".$row['SPA'].">".$row['SPA']."</a></td>";

	  echo "</tr>";
	
	 $b =$row['SiteId']; 
  }
echo "</table>";


mysql_close($con);

?>
2
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by ayesha789
0

you should use LIMIT in you query.

SELECT * FROM foo LIMIT $count,$start,;

$count is the count of rows you want to display at a time.
you'll need to pass $start for each pages via URL.

<a href="page.php?start=5">Next page</a>

value of $start will be constructed dynamically depends on currently displayed data. If you currently displayed data is 6-10, then next page should be 11-15.

<?php
if(!$start)$start=0;
$count=3;
SELECT * FROM foo LIMIT $count,$start;
//display
$start = $_GET['start']+$count;
?>
<a href="page.php?start=<?php echo $start; ?>">Next page</a>

code above is to display link to Next page only.

0
$result = mysql_query("SELECT * FROM leaseentry  WHERE LAPeriodEnd like '%-07-%'");

Where i put $count and $start in my code.
confused.......;)

0

for example my page name is show.php
then how I can use paging?
Please Please guide me?

This question has already been answered. 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.