PHP Classes

File: example5-1.php

Recommend this page to a friend!
  Classes of Andrej Bodor   deadatagrid   example5-1.php   Download  
File: example5-1.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: 15 years ago
Size: 1,231 bytes
 

Contents

Class file image Download
<?php
//header("Content-type: text/html;charset=windows-1250");
?>
<link rel="stylesheet" type="text/css" href="style.css" />
<script language="javascript" type="text/javascript" src="util.js"></script>
<?php

require 'datagrid.class.php';
require_once
'dbconfig.php';
$conn = mysql_connect(DB_HOST, DB_USER, DB_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 = 'example5-1.php';

$grid->setSqlSelect("select * from lang_forms");

$grid->rowformat = "<tr%s>%s</tr>\n";
$grid->rowclick = '$rowclick="
   onclick=\" document.getElementById(\'langf\').value=\'$field\';
   document.getElementById(\'lablangf\').value=\'$row[idlang]\';
   document.getElementById(\'h_d\').style.display = \'none\';
   document.getElementById(\'langf\').focus();\";";'
;
?>
<table border="0" width="100%" 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>