PHP Classes

File: clientCode.php

Recommend this page to a friend!
  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: 18 years ago
Size: 1,515 bytes


Class file image Download
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<title>Sample code</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

$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.