What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP Pagination help

PHP Pagination help
Author: Message:
DJeX
Veteran Member
*****

Avatar


Posts: 1138
Reputation: 11
– / Male / –
Joined: Jul 2003
O.P. Huh?  PHP Pagination help
I want to add pagination to my php script/site im making. It's going to be a search engine so it's necessary that I have pagination in it.

I've searched Google and found many pagination tutorials but they either do not work or are a pain to understand.

Would any one be kind enough to help me integrate pagination into my php site?

Heres the code:

code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<div align="center">

<?php
echo "<form name=\"form1\" method=\"post\" action=\"index.php\">
<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr><td><div align=\"center\"><input name=\"search\" type=\"text\" id=\"search\" size=\"50\"> <input type=\"submit\" name=\"Submit\" value=\"Search\"></div></td></tr>
</table>
</form>";

if (!$_POST['search'])
{
  echo "<p>Please enter a search...</p>";
}
else
{
$var = $_POST['search'] ;
$search = trim($var);


mysql_connect($db_host, $db_user, $db_pass);
mysql_select_db($db_database);


$query = mysql_query("SELECT * FROM search WHERE description LIKE '%" . $search . "%'");
$numrows=mysql_num_rows($query);


if ($numrows)
  {
  echo '<BR>
  <table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#000000">
  <tr><td><table width="100%" border="0" cellpadding="1" cellspacing="0" bgcolor="#9FC3FF">
  <tr><td width="49%"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Searched for: <strong>' . $search . '</strong></font></td>
  <td width="51%"><div align="right"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">' . $numrows . ' Result(s)</font></div></td>
  </tr></table></td></tr></table>
  <br>';       


  while ($data = mysql_fetch_array($query)) {
  $title = $data['title'];
  $desc = $data['description'];
  $link = $data['link'];
               
  echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr><td><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><strong>' . $title . '</strong></font></td></tr>
  <tr><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif">' . $desc . '</td></font></tr>
  <tr><td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><font color="#009933"><a href="' . $link . '">' . $link . '</a></font></td></tr></table>
  <BR>';

// exit;
}   
  } else {
  echo "<center><strong>No result found, please try again.</strong></center>";           
  }
}


?>

<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">Powered By (dont know yet).<br>
</font><font size="2" face="Verdana, Arial, Helvetica, sans-serif">&copy; 2006 Music Related Network</font></p></div>
</body>
</html>
[Image: top.gif]
04-20-2006 01:08 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP Pagination help - by DJeX on 04-20-2006 at 01:08 AM
RE: PHP Pagination help - by Lou on 04-20-2006 at 01:15 AM
RE: PHP Pagination help - by DJeX on 04-20-2006 at 01:58 AM
RE: PHP Pagination help - by segosa on 04-20-2006 at 05:37 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On