Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: PHP Database Related MySQL Record Pagination Tutorial

How to give your users the benifit of putting the results of their query on different pages

Tutorial Details:

PHP/MySQL and Visual Basic

What is pagination?
You see pagination everyday when you use http://www.google.com , at the very bottom of the page, you will see a list of pages, all of which have the next set of records for your particular search.

Whats the point?
Well the most blatently obvious point is that you are able to deliver results to your users in chunks that are far easier to digest, and look much prettier =D
Okay, enough chit-chat.. tell me how to do it!
Okay, lets start with a simple query.

If you are not familiar with SQL , then go learn!
Now chances are that the above SQL statment will return far more than 1 result. So lets firstly output all of the records that we find.

This is how to loop through all of the records that you get..
PHP Code
//connect to the database
$connect = mysql_connect ( "server" , "username" , "password" );
mysql_select_db ( "dbname" );
$sql = "SELECT * FROM `logs`" ;
$query = mysql_query ( $sql , $connect );
if( mysql_num_rows () > 0 )
{
while( $record = mysql_fetch_assoc ( $query ))
{
echo $record [ "ip_addr" ];
}
}
else
{
echo "There were no records found!" ;
}
?>

Okay, so as you see, that will loop through all of the results, and then give me
the value of the column "ip_addr", and echo it out to the browser. To get at different columns within the database, you will just need to change the key of the array, ie to get at the column "log_id", you will write $record['log_id'], its not hard to understand =D


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
PHP Database Related MySQL Record Pagination Tutorial

View Tutorial:
PHP Database Related MySQL Record Pagination Tutorial

Related Tutorials:

Use a RandomAccessFile to building a low-level database - JavaWorld January 1999
Use a RandomAccessFile to building a low-level database - JavaWorld January 1999
 
Build database-powered mobile applications on the Java platform
Build database-powered mobile applications on the Java platform
 
Develop Java portlets
Develop Java portlets
 
SQL Database Access with DBTags
SQL Database Access with DBTags In a J2SE or J2EE application, Java Database Connectivity (JDBC) can be used to create a connection with a SQL database, create database tables, retrieve result sets, and update the database. To use a database from a Jav
 
Using CachedRowSet to Transfer JDBC Query Results Between Classes
Using CachedRowSet to Transfer JDBC Query Results Between Classes The Java Database Connectivity (JDBC) API provides developers with an interface to a SQL database server, such as MySQL or Oracle. Central to any JDBC application is the java.sql.ResultS
 
JForumFusion
About jForumFusion JForumFusion is a platform independent discussion board program.
 
Jeff Schmitt's JDBC Page
This tutorial assumes you are using the MySQL database and the GWE JDBC drivers. The host computer is triton.towson.edu.
 
Backing Up and Restoring A MySQL Database
Backing Up and Restoring A MySQL Database Backing Up and Restoring A MySQL Database This tutorial explains the how to backup and restore the MySQL Database. Databases are used to store large amount of precious data and it becomes very important to
 
Welcome to Java Developers paradise!
Welcome to Java Developers paradise! T his site contains many quality Java, JSP, RMI, MySQL downloads, tutorials, source codes and links to other java resources. We have large number of links to the tutorials on java which will help you learn java
 

Linux Hosting Plans Proxima Web-Hosting Our basic hosting packages include support for a wide variety of web technologies, backed by instant account management with our Personal Control panel. With our guaranteed
 
First Step towards JDBC!
First Step towards JDBC! Welcome to our JDBC Section First Step towards JDBC This article introduce you with JDBC and shows you how to create a database application to access the databases. Accessing the Database from Servlet This article shows
 
Accessing Database from servlets through JDBC!
Accessing Database from servlets through JDBC! Accessing Access Database From Servlet T his article shows you how to access database from servlets. Here I am assuming that you are using win95/98/2000 and running Java Web Server. For the sake of
 
We are providing Downloadable Version of Mandrake 10.1 Community Edition Linux CD's.
We are providing Downloadable Version of Mandrake 10.1 Community Edition Linux CD's. Mandrake 10.1 Community Edition Linux Now Available Mandrake 10.1 Community Edition CD's Mandrake 10.1 Community, released in Sept. 16, 2004 is an incremental
 
Welcome to the MySQL Tutorials
Welcome to the MySQL Tutorials Welcome to the MySQL Tutorials Using MYSQL Database This lesson is intended to provide hands an experience with MYSQL database Backing Up and Restoring A MySQL Database In this lession you will learn how to take
 
Using MYSQL Database with JSP & Servlets.
Using MYSQL Database with JSP & Servlets. Using MYSQL Database with JSP & Servlets. MY SQL is a powerful RDBMS, which can handle large amount of data. And more interestingly it is free to use, except for some commercial use. you can download it
 
Connecting to MySQL database and retrieving and displaying data in JSP page
Connecting to MySQL database and retrieving and displaying data in JSP page Connecting to MySQL database and retrieving and displaying data in JSP page This tutorial shows you how to connect to MySQL database and retrieve the data from the
 
Connecting to the Database Using JDBC and Pure Java driver
Connecting to the Database Using JDBC and Pure Java driver Connecting to the Database JDBC Driver In our search engine we are using MySQL database server and MM.MySQL Driver for connecting our application to the database. MM.MySQL Driver is
 
Building Search Engine Applications Using Servlets !
Building Search Engine Applications Using Servlets ! Building Search Engine Applications Using Servlets Please visit http://www.webappcabaret.com/javadevelopers/search to see running copy of our search engine. Introduction This tutorial takes
 
Web Hosting Guide. Introduction to Domain Name
Web Hosting Guide. Introduction to Domain Name Introduction to Domain Name What is Domain Name? If we have to send a letter to someone, we must know his/her mailing address. In the same way if we want to visit a website, we also need to know its
 
What is Web Hosting
What is Web Hosting What is Web Hosting? What is Web Hosting? If you have a company and want web presence than you need a website. With the website any one from the world must be able to view your pages, images etc. Website is actually a
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.