Login   Register  
PHP Classes
elePHPant
Icontem

File: example4.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Andrej Bodor  >  deadatagrid  >  example4.php  >  Download  
File: example4.php
Role: Example script
Content type: text/plain
Description: datagrid
Class: deadatagrid
Display MySQL query results in an HTML table
Author: By
Last change:
Date: 5 years ago
Size: 3,496 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>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Example 4 Datagrid</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script language="javascript" type="text/javascript" src="util.js"></script>
</head>
<body>
<?php
require 'datagrid.class.php';
require_once 
'dbconfig.php';
$conn mysql_connect(DB_HOSTDB_USERDB_PASSWORD) or die('Connection to database failed: ' mysql_error());
mysql_select_db(DB_NAME) or die ('select_db failed!');

$grid = new Datagrid($conn,'1');
$grid->baselink 'example4.php';

//set sql or table
//$grid->setSqlSelect("select * from lang");
$grid->setFrom('lang');
$grid->setFieldName('name,id,path_img');
$grid->setColWidth('20%,20%,0%');
$grid->setColType('path_img',datagrid::TYPE_IMAGE);

$grid->fieldformat='<td class="dtd">%s</td>';
$grid->setRowsPerPage(5);
$grid->setKeyID(1);


$grid1 = new Datagrid($conn,'2');
$grid1->baselink 'example4.php';

$grid1->setFrom('lang_forms');
$grid1->setFieldName('id,idlang,form,comp,title');
$grid1->setColName('Sifra,Sifra lang,Forma,Comp,Title');
$grid1->setColWidth('10%,15%,15%,30%,0%');

if(isset(
$_GET['keyid1']))
   
$grid1->setWhereM('IDLang:'.$_GET['keyid1']);
else
   
$grid1->setWhereM('IDLang:1');

$grid1->fieldformat='<td class="dtd">%s</td>';

$grid1->setMaxNavLinks(4);
$grid1->setRowsPerPage(15);

//$grid1->curpageformat = '<span>[%s]</span>';
//$grid1->curpageformat = '<span class="lnkimage1">&nbsp;&nbsp;%s&nbsp;&nbsp;&nbsp;</span>';

$grid1->navnext='<img src="image/arrow_right.gif" class="tbl-arrows">';
$grid1->navlast='<img src="image/arrow_last.gif" class="tbl-arrows">';
$grid1->navfirst='<img src="image/arrow_first.gif" class="tbl-arrows">';
$grid1->navprev='<img src="image/arrow_left.gif" class="tbl-arrows">';

//$grid1->navnextd='<img src="image/arrow_right_disabled.gif" class="tbl-arrows">';
//$grid1->navlastd='<img src="image/arrow_last_disabled.gif" class="tbl-arrows">';
//$grid1->navfirstd='<img src="image/arrow_first_disabled.gif" class="tbl-arrows">';
//$grid1->navprevd='<img src="image/arrow_left_disabled.gif" class="tbl-arrows">';

$grid1->navup='<img src="image/arrow_up.gif" class="tbl-arrows">';
$grid1->navdown='<img src="image/arrow_down.gif" class="tbl-arrows">';
?>
<div style="visibility:hidden; background-color:white; border: 0px solid black;" id="h_t"></div>
<!--<div id="h_t"></div>-->
<div id="h_d">
<strong>Sample master/details grid with sort, paging, search...</strong>
<br><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<td width="40%" valign="top">
<table class="dtable" width="100%" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<?php echo $grid->getHeader();?>
</tr>
</thead>

<tbody>
<?php echo $grid->getRows();?>
</tbody>

<tfoot>
<tr>
<td colspan="5" align="center">
<span id="navlinks"><?php echo $grid->getFoot();?></span>
</td>
</tr>
</tfoot>
</table>
</td>
<td valign="top">
<table class="dtable" width="100%" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<?php echo $grid1->getHeader();?>
</tr>
</thead>

<tbody>
<?php echo $grid1->getRows();?>
</tbody>

<tfoot>
<tr>
<td colspan="5" align="center">
<span id="navlinks"><?php echo $grid1->getFoot();?></span>
</td>
</tr>
</tfoot>
</table>
</td>
</div>
</body>
</html>