Login   Register  
PHP Classes
elePHPant
Icontem

File: AjaxExampleWithNumberOfResultsSelector.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of kai  >  Report  >  AjaxExampleWithNumberOfResultsSelector.php  >  Download  
File: AjaxExampleWithNumberOfResultsSelector.php
Role: Example script
Content type: text/plain
Description: example
Class: Report
Show MySQL results in pages updated using AJAX
Author: By
Last change:
Date: 2010-02-09 05:12
Size: 2,792 bytes
 

Contents

Class file image Download
<?php

$dbuser
="root";
$dbpassword="";
$dbhost="localhost";
$dbname="testutilities";

$itemsPerPage=6;

include_once(
"report.php");

mysql_connect($dbhost,$dbuser,$dbpassword);
mysql_select_db($dbname);




$rep= new Report("select * from test_report_class",$itemsPerPage);

$rep->addDisplayField('name','Name',150);
$rep->addSpecialDisplayField('val',"Value","<a href='javascript:alert(\"You selected {val} from {name}\")' >{val}</a>",100);
$rep->enableNavigationalNumbers(2);

$rep->setSortASCPicture("sortup.png");
$rep->setSortDESCPicture("sortdown.png");

$rep->setTableClassName("data");
$rep->setNavigationTableClassName("nav");

$rep->setNavigationLinkClass("navlink");
$rep->setSortLinkClassName("sortlink");

$rep->enableAjax($dbhost,$dbuser,$dbpassword,$dbname);

?>

<html>
<head>
<?php 
$rep
->drawAjaxHeadHtml();
?>
<title>example</title>
<style type="text/css">
table.data {
    border-width: 4px 4px 4px 4px;
    border-spacing: 2px;
    border-style: dotted dotted dotted dotted;
    border-color: gray gray gray gray;
    border-collapse: separate;
    background-color: white;
}
table.data th {
    border-width: 1px 1px 1px 1px;
    padding: 1px 1px 1px 1px;
    border-style: groove groove groove groove;
    border-color: blue blue blue blue;
    background-color: rgb(250, 240, 230);
    -moz-border-radius: 0px 0px 0px 0px;
}
table.data td {
    border-width: 1px 1px 1px 1px;
    padding: 1px 1px 1px 1px;
    border-style: groove groove groove groove;
    border-color: blue blue blue blue;
    background-color: rgb(250, 240, 230);
    -moz-border-radius: 0px 0px 0px 0px;
}


table.nav {
    border-width: 4px 4px 4px 4px;
    border-style: dashed dashed dashed dashed;
    border-color: gray gray gray gray;
    border-collapse: separate;
    background-color: white;
}
table.nav th {
    border-width: 0px 0px 0px 0px;
    border-style: none none none none;
    border-color: blue blue blue blue;
    background-color: rgb(255, 250, 250);
    -moz-border-radius: 0px 0px 0px 0px;
}
table.nav td {
    border-width: 1px 1px 1px 1px;
    padding: 1px 1px 1px 1px;
    border-style: none none none none;
    border-color: blue blue blue blue;
    background-color: rgb(255, 250, 250);
    -moz-border-radius: 0px 0px 0px 0px;
    text-align: center;
}

a.navlink:link{
    color:#00ffff;
}

a.navlink:visited{
    color:#00FF20;
}

a.navlink:hover{
    color:#c69c6d;
}



a.sortlink:link{
    color:#ffff00;
}

a.sortlink:visited{
    color:#e20005;
}

a.sortlink:hover{
    color:#c6dc69;
}


a.sortlink img {border: none;}

</style>
</head>

<body>

<?php 

echo "Number of results per page ";
$rep->getNumberOfResultsPerPageSelector(5,100);
$rep->getNumberOfResultsSelectorGoLink("Go");

$rep->draw();
$rep->getNavigationBar();

?>
</body>
</html>