Grid not rendering – Only see code from PHP file

QuestionsGrid not rendering – Only see code from PHP file
Chris asked 9 years ago

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"&gt;
<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>

8 Answers
Abu Ghufran answered 9 years ago

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

Chris answered 9 years ago

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!

Abu Ghufran answered 9 years ago

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

Chris answered 9 years ago

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.

Abu Ghufran answered 9 years ago

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.

Chris answered 9 years ago

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"&gt;
<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>

Abu Ghufran answered 9 years ago

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

Chris answered 9 years ago

Abu, you rock, thank you so much!

That fixed the code display, and after a couple PHP troubleshooting issues, it's working perfectly, and easy to customize!

Thanks again!!
Chris

Your Answer

10 + 15 =

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?