Dear Abu,
I have downloaded your sample code (phpgrid V1.4.6).
First of all, I would like to congratulate you for developing such an amazing phpgrid.
I just want to know – How can we display more than one tables by using same grid?
I have to develop an application which is having 4 datagrid at one page and each grid is connected to each table.
I tried to solve my problem this way:(but its not working, sample table data showing in both tables)
i have just copied some portion of the code once more.
<?php
/**
* PHP Grid Component
*
* @author Abu Ghufran <[email protected]> – http://www.phpgrid.org
* @version 1.4.6
* @license: see license.txt included in package
*/
// set up DB
$conn = mysql_connect("localhost", "root", "");
mysql_select_db("griddemo");
// set your db encoding — for ascent chars (if required)
mysql_query("SET NAMES 'utf8'");
// include and create object
include("inc/jqgrid_dist.php");
$g = new jqgrid();
// set few params
$grid["caption"] = "Sample Grid";
$grid["multiselect"] = true;
$g->set_options($grid);
// set database table for CRUD operations
$g->table = "clients";
// subqueries are also supported now (v1.2)
// $g->select_command = "select * from (select * from invheader) as o";
// render grid
$out = $g->render("list1");
$g1 = new jqgrid();
// set few params
$grid1["caption"] = "Sample Grid1";
$grid1["multiselect"] = true;
$g1->set_options($grid1);
// set database table for CRUD operations
$g1->table = "clients1";
// subqueries are also supported now (v1.2)
// $g->select_command = "select * from (select * from invheader) as o";
// render grid
$out1 = $g1->render("list11");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="js/themes/redmond/jquery-ui.custom.css"></link>
<link rel="stylesheet" type="text/css" media="screen" href="js/jqgrid/css/ui.jqgrid.css"></link>
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script>
<script src="js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
</head>
<body>
<div style="margin:10px">
<?php echo $out?>
</div>
<div style="margin:10px">
<?php echo $out1?>
</div>
</body>
</html>