Location: PHPKode > scripts > deadatagrid > deadatagrid/example5-2.php
<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,'2');
$grid->baselink = 'example5-2.php';

$grid->setFrom('lang');
$grid->setFieldName('name,id,path_img');
$grid->setColWidth('20%,20%,0%');
$grid->setColType('path_img',datagrid::TYPE_IMAGE);

$grid->rowformat = "<tr%s>%s</tr>\n";
$grid->rowclick = '$rowclick="
   onclick=\" document.getElementById(\'lang\').value=\'$field\';
   document.getElementById(\'lablang\').value=\'$row[name]\';
   document.getElementById(\'h_d\').style.display = \'none\';
   document.getElementById(\'lang\').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>
Return current item: deadatagrid