|
|
|
<?
//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> ");
}
//echo $pages;
for($j=1;$j<=$pages;$j++)
{
if($j==$ppage)
{
echo $j;
}
else
{
printf("<a href=example.php3?ppage=$j>$j</a> ");
}
}
if($ppage<$pages)
{
$nextpage=$ppage+1;
printf("<a href=myexample.php3?ppage=$nextpage>Next</a> ");
}
?>
|
|
| 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!
| |
|
|