WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Mobile Dev World

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : This class splits the results of the query into multiple pages like what the search engine does.
Categories : PHP Classes, PHP, MySQL, Databases Update Picture
Sandeep Raja
Date : Feb 23rd 2001
Grade : 3 of 5 (graded 6 times)
Viewed : 7394
File : split.tar.gz
Images : No Images for this code example.
Search : More code by Sandeep Raja
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?

//Usage :
//=======



/* this is an example which splits the query results into multiple pages as search engine does
you can change the query and format in which the result is being printed
*/
include("split.class.php3");



$sql="select * from TABLE"; //query

$ord=new Split($sql,10); //create an object of split pass the sql and total no of rows to
be displayed in a page
if($ord->error!="")
{
die("ERROR" . $ord->error);
}

$rows=$ord->display($ppage);

$pages=$ord->total(); //get the total no of pages



while($myrow=mysql_fetch_row($rows))
{
//print the results over here

printf("Name is $myrow[0]<br>"); //this is just a test value
}
//*************************************************************************
******************

// now the links to other pages will be displayed with back and next

//*************************************************************************
*******************
if(($ppage=="")||($ppage<="0") )
{
$ppage=1; //as default if the requested page is less than 0 the first page
is printed
}
if($ppage > $pages)
{
$ppage=$pages; //if the requested page is greater than total pages the last page
is shown
}
if($ppage>1)
{
$backpage=$ppage-1;
printf("<a href=example.php3?ppage=$backpage>Back</a>&nbsp;&nbsp;&nbsp;");

}
//echo $pages;
for($j=1;$j<=$pages;$j++)
{
if($j==$ppage)
{
echo $j;
}
else
{
printf("<a href=example.php3?ppage=$j>$j</a>&nbsp;&nbsp;&nbsp;");
}
}
if($ppage<$pages)
{
$nextpage=$ppage+1;
printf("<a href=myexample.php3?ppage=$nextpage>Next</a>&nbsp;");

}
?>



Password reminder
Categories : PHP, PHP Classes, Databases, MySQL, Mail
Specify your connection settings and create a link to a MySQL database.
Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides
Online Automatic Class Generator for MySQL Tables
Categories : PHP, PHP Classes, Classes and Objects, Databases, MySQL
MySQL Connection/Query Class
Categories : Databases, MySQL, PHP, PHP Classes
phpFormGenerator for Dynamic Form Generation from MySQL
Categories : PHP, PHP Classes, MySQL, Databases, HTML and PHP
Create and restore backup of MySQL databases
Categories : MySQL, Databases, PHP, PHP Classes, Complete Programs
DBXML- A Class to backup databases in XML Format using web interface
Categories : PHP, PHP Classes, Databases, MySQL, XML
MySQL Class to ease Database connectivity
Categories : MySQL, PHP Classes, Databases, PHP
MySQL database class
Categories : PHP, MySQL, Databases, PHP Classes
Ajax PHP Tree (Left and Right) with MySQL
Categories : PHP, Databases, MySQL, AJAX, PHP Classes
YellowPages Content Grabber (PHP5 +)
Categories : PHP, PHP Classes, Regexps, Databases, MySQL
TAB_STRUCT Class: Is supporting Class for the DBXML Class
Categories : PHP, PHP Classes, MySQL, XML, Databases
Setting up InnoDB on MySQL and using Transactions Begin, Commit, Rollback in PHP.
Categories : PHP Classes, Databases, PHP, MySQL, InnoDB
PHP Transfer data from text file to Mysql Table
Categories : PHP, PHP Classes, Filesystem, Databases, MySQL
Sort the results from a SELECT query (any number of columns) into an array automatically.
Categories : PHP, PHP Classes, Arrays, Databases, MySQL
 Kellog MK wrote :895
Very useful script to make a search engine !!! Thanks a lot, man!