Page 1 of 1

How to do paging in a PHP...!

Posted: Tue Feb 17, 2009 3:55 am
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);
?>
 

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

Posted: Tue Feb 17, 2009 5:57 am
by Paul Arnold
There are plenty of pagination classes out there.
Have a search on Google.

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

Posted: Tue Feb 17, 2009 8:01 am
by susrisha
There are many available in the code critique module of the forum.. try to search the forum first then google it out..