Problem with master_detail.php

QuestionsProblem with master_detail.php
Paolo D. asked 8 years ago

I'm trying to test the master_detail.php example on MS Sql server.
My code is:

<?php

/**
* PHP Grid Component
*
* @author Abu Ghufran <[email protected]> – http://www.phpgrid.org
* @version 2.0.0
* @license: see license.txt included in package
*/

$db_conf = array();
$db_conf["type"] = "mssqlnative"; // or mssql
$db_conf["server"] = "my server"; // ip:port
$db_conf["user"] = "my user";
$db_conf["password"] = "my password";
$db_conf["database"] = "my db";

include("/lib/inc/jqgrid_dist.php");
// master grid

$grid = new jqgrid($db_conf);

$opt["caption"] = "Clients Data";
$opt["width"] = 600;
$grid->set_options($opt);
$grid->table = "clients";
// generate grid output, with unique grid name as 'list1'
$out_master = $grid->render("list1");

// second grid
$grid = new jqgrid($db_conf);

$opt["sortname"] = 'id'; // by default sort grid by this field
$opt["sortorder"] = "desc"; // ASC or DESC
$opt["height"] = ""; // autofit height of subgrid
$opt["caption"] = "Invoice Data"; // caption of grid
$opt["width"] = 800;
$opt["multiselect"] = true; // allow you to multi-select through checkboxes
$opt["export"] = array("filename"=>"my-file", "sheetname"=>"test"); // export to excel parameters
$grid->set_options($opt);

$grid->set_actions(array(
"add"=>true, // allow/disallow add
"edit"=>true, // allow/disallow edit
"delete"=>true, // allow/disallow delete
"rowactions"=>true, // show/hide row wise edit/del/save option
"export"=>true, // show/hide export to excel option
"autofilter" => true, // show/hide autofilter for search
"search" => "advance" // show single/multi field search condition (e.g. simple or advance)
)
);

// this db table will be used for add,edit,delete
$grid->table = "invheader";

// generate grid output, with unique grid name as 'list2'
$out_detail = $grid->render("list2");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;
<html>
<head>
<link rel="stylesheet" type="text/css" media="screen" href="lib/js/themes/redmond/jquery-ui.custom.css"></link>
<link rel="stylesheet" type="text/css" media="screen" href="lib/js/jqgrid/css/ui.jqgrid.css"></link>

<script src="lib/js/jquery.min.js" type="text/javascript"></script>
<script src="lib/js/jqgrid/js/i18n/grid.locale-it.js" type="text/javascript"></script>
<!– <script src="lib/js/jqgrid/js/i18n/grid.locale-en.js" type="text/javascript"></script> –>
<script src="lib/js/jqgrid/js/jquery.jqGrid.min.js" type="text/javascript"></script>
<script src="lib/js/themes/jquery-ui.custom.min.js" type="text/javascript"></script>
</head>
<body>
<div style="margin:10px">
<?php echo $out?>
</div>
</body>
</html>

The code is very similar to the example, I had only to change db connection.

The result is a blank page. Just to be sure I tried each table separately and they show correctly (obv. I had to change last row from out_detail to simply out).
I tried with error message on but no error message is displayed.
Via firefox/firebug I got this error 500 but I have no idea what's wrong:

HTTP/1.0 500 Internal Server Error
Date: Wed, 22 Mar 2017 16:54:25 GMT
Server: Apache/2.4.16 (Win32) OpenSSL/1.0.1p PHP/5.6.12
X-Powered-By: PHP/5.6.12
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

I have version phpgrid-full-v2.0 (received via email on 13/9/2016), I don't know if it's the latest

Any idea?

1 Answers
Paolo L. answered 8 years ago

Fixed. The problem was an error in the HTML code

<?php echo $out?>

instead of

<?php echo $out_master ?>
<br>
<?php echo $out_detail; ?>
</div>

Your Answer

6 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?