When trying to create my first grid, integrated with our MySQL db, I navigate to the PHP file in IE but only see the following "set_options($grid); // set database table for CRUD operations $g->table = "dim_billing"; // render grid and get html/js output $out = $g->render("list1"); ?>"
The PHP file is as follows, please help!:
<?php
include_once("../../config.php");
// include_once("config.php");
// set up DB
mysql_connect(**DB IP**, **User**, **PW**);
mysql_select_db(neto_cm);
// include and create object
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
// set few params
$grid["caption"] = "Sample Grid";
$g->set_options($grid);
// set database table for CRUD operations
$g->table = "dim_billing";
// render grid and get html/js output
$out = $g->render("list1");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<!– these css and js files are required by php grid –>
<link rel="stylesheet" href="../../lib/js/themes/redmond/jquery-ui.custom.css"></link>
<link rel="stylesheet" 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-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>
<!– these css and js files are required by php grid –>
</head>
<body>
<div style="margin:10px">
<!– display grid here –>
<?php echo $out?>
<!– display grid here –>
</div>
</body>
</html>
If i understand the issue correctly, Perhaps, you are not opening php file with webserver url.
It should be something like: http://localhost/folder/file.php
Will not work with C:…..file.php
Hey Abu!
I am trying to open it via http://localhost/folder/file.php, but the IE page just displays what I have above.
Is there some variable or setting or configuration in IIS I may have missed that would cause the grid not to render?
Thanks again!
Check following:
1) Confirm if php is executing by IIS by a test php file (with no grid code).
2) Check if file.php contains starting php tags <?php
It is executing, I can view all of the PHP installation files for PHP Grid.
I put the full PHP file we are trying to use in the initial post, it does include the tags.
It looks like it's just not generating the grid.
Hello,
I can't guess the issue. Can you view source the page and see what html is in output source.
Also check error log file of webserver.
Including view source information below, checked the Webserver-IIS logs and do not see any errors 🙁
<?php
include_once("../../config.php");
// include_once("config.php");
// set up DB
mysql_connect(***, ***, **);
mysql_select_db(**);
// include and create object
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");
// set few params
$grid["caption"] = "Sample Grid";
$g->set_options($grid);
// set database table for CRUD operations
$g->table = "dim_billing";
// render grid and get html/js output
$out = $g->render("list1");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<!– these css and js files are required by php grid –>
<link rel="stylesheet" href="../../lib/js/themes/redmond/jquery-ui.custom.css"></link>
<link rel="stylesheet" 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-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>
<!– these css and js files are required by php grid –>
</head>
<body>
<div style="margin:10px">
<!– display grid here –>
<?php echo $out?>
<!– display grid here –>
</div>
</body>
</html>
This looks like your IIS is not parsing + executing php tags.
Refer the mapping case: http://stackoverflow.com/questions/27787932/php-on-iis-displaying-php-code-instead-of-page