<!--
include a CSS file with definitions for
table.sql_data_browsing
tr.sql_data_browsing
td.sql_data_browsing
//-->
<link rel="stylesheet" type="text/css" href="css.css">
<?php
// connect to the mySQL server
$dbcon = mysql_connect("localhost", "root", "")
or die ("Could not connect to MySQL");
// select the database
mysql_select_db ("test")
or die ("Could not select database");
// make the query
$sql_result = mysql_query ("SELECT * FROM test_table");
// include the classes
require_once ("sql_data_browsing.class.php");
require_once ("pagination.class.php");
/*
##
## Configuration
##
*/
$records_per_page = 25; // number of records on a page
(int)$page = $_GET["pag"]; // get the curent page
// first page is 0 and not 1
// on output the first page will be 1 so users will not get something like: page 0 , page 1 , page 2 , etc
$table_colors = "EFEFEF_CCCCCC_E0E1BF_E1C05C"; // the 4 colors used in the table
// HTML code without the "#" in front
// color 1 = backgroud for odd rows
// color 2 = background for even rows
// color 3 = background for mouse over rows
// color 4 = background for selected rows (after a click on a row)
$no_data_text = "No data to show"; // text to show when there is no data retrived from the query
$pagination_link ="$PHP_SELF?pag="; // the URL for the pagination links
// the page number will be added after the link
$pagination_links_patern = "[ %s ]"; // the patern for showing the page numbers
// where there is %s , there will the page number will be shown
$sql_data = new sql_data_browsing($sql_result, $page, $records_per_page, $table_colors, $no_data_text);
$sql_pag = new pagination($sql_result, $page, $records_per_page, $pagination_link, $pagination_links_patern);
// output data
$sql_data -> show_data(); // output the data from the sql result
$sql_pag -> show_pagination(); // output the page numbers (pagination links)
// Please send your suggestions, bug reports and general feedback to dragos@protung.ro
?>
|