Login   Register  
PHP Classes
elePHPant
Icontem

File: clientCode.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Reza Salehi  >  Easy Data Grid  >  clientCode.php  >  Download  
File: clientCode.php
Role: Example script
Content type: text/plain
Description: the sample code uses dataGrid
Class: Easy Data Grid
Display MySQL query results in an HTML table
Author: By
Last change:
Date: 2005-11-29 03:57
Size: 1,515 bytes
 

Contents

Class file image Download
<!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>