<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sample code</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php
include("datagrid.class.php");
//
$link=mysql_connect($host, $user, $pass);
mysql_select_db($dbName, $link);
$users=mysql_query("SELECT userID, username, password, email, tel, fax FROM users");
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// signature : dataGrid($dataSource, $dataKeyField, $fieldsToShow, $nextPage, $nextPageLable, $rowColor, $width)
// $dataSource=$users;
// $dataKeyField(Promary key)="userID";
// $fieldsToShow(Array of columns names)=array(0=>"username", 1=>"webSite", 2=>"password", 3=>"email");
// it means that just username, password and email columns will be shown in the grid.
// $nextPage(Page you want to do some action on selected row element.)=activateUsers.php;
// $nextPageLable(Label to be shown in dataGrid)="Activate this User";
// $rowColor="#eeeeee";
// $width="600";Pixels
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$g=new dataGrid($dataSource, "userID", array(0=>"username", 1=>"webSite", 2=>"password", 3=>"email"), "activateUsers.php",
"Activate this User", "#eeeeee", "600");
$g->create();//Shown the grid.
?>
</body>
</html>
|