How to do paging in a PHP...!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
asad_black
Forum Newbie
Posts: 20
Joined: Wed Feb 11, 2009 1:59 am

How to do paging in a PHP...!

Post by asad_black »

this my code in this searching is perform now i want to do paging.

Code: Select all

<?php
$var = @$_GET['q'] ;
$trimmed = trim($var);
$con = mysql_connect("localhost","sample","sample");
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }
mysql_select_db("sample", $con);
$sql = mysql_query("SELECT * FROM links where kw like \"%$trimmed%\"");
echo "<table border=0 cellspacing=5>";
  echo "<tr>";
while($row = mysql_fetch_array($sql))
  {
 
 
 echo "<td class=style28 width=200>";
echo "<center>";
echo $row['text'];
 echo"</center>";
 
echo "<a href=\"" . $row["link"] . "\"><br>
<center><img src=\"" . $row["image"] . "\" height='80' width='80' border=0 alt=\"" . $row["text"] . "\">
</a>" ;
echo $row['des'];
echo "</center>";
echo "</td>";
 
  }
   echo "</tr>";
  echo "</table>";
mysql_close($con);
?>
 
Paul Arnold
Forum Contributor
Posts: 141
Joined: Fri Jun 13, 2008 10:09 am
Location: Newcastle Upon Tyne

Re: How to do paging in a PHP...!

Post by Paul Arnold »

There are plenty of pagination classes out there.
Have a search on Google.
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: How to do paging in a PHP...!

Post by susrisha »

There are many available in the code critique module of the forum.. try to search the forum first then google it out..
Post Reply