0

Grid 4 PHP allows to set the debug mode on or off:

Debug mode is enabled by default and it will show the server side failure reason.

When debug mode is on and a query fails I get a blank page with the error details. Example:

Couldn't execute query. Table 'db.clients' doesn't exist - SELECT * FROM customers WHERE 1=1 LIMIT 1 OFFSET 0

If I turn off the debug mode, it still shows a blank page with a more generic (and customizable) message:

Some issues occured in this operation, Contact technical support for help

I don't want a blank page:

blank page

I'd like my PHP page will load as usual and only the grid affected by the SQL issue should not render.

Is it possible to configure Grid 4 PHP (or perhaps it is a more generic PHP feature?) to process the other working part of my page?

Sample code:

<?php
include_once("../../config.php");
include(PHPGRID_LIBPATH."inc/jqgrid_dist.php");

$db_conf = array(
                    "type"      => PHPGRID_DBTYPE,
                    "server"    => PHPGRID_DBHOST,
                    "user"      => PHPGRID_DBUSER,
                    "password"  => PHPGRID_DBPASS,
                    "database"  => PHPGRID_DBNAME
                );

$g = new jqgrid($db_conf);

$opt["caption"] = "Customers";
$g->set_options($opt);
$g->table = "clients";
?>

<?php include ('header.php'); ?>

<div class="row flex-nowrap">
    <?php include('navigation.php'); ?>
    <!-- some other HTML stuff -->
    <div class="col"> 
        <?php echo $table?>
    </div>
</div>

<?php include('footer.php');
3
  • No. If it crashes the whole script will stop. The only way round that would maybe be if you load the grid stuff separately via an ajax request, so it's a different script execution than the rest of the page. Commented Aug 18, 2024 at 19:08
  • But that would only be worth it if you think the grid code is going to be unreliable on a regular basis. And it's unclear why you'd expect that. If there's an issue, just fix it Commented Aug 18, 2024 at 19:09
  • you have a triggers on customers that wanzs some of a not existing table , so fix the trigger Commented Aug 18, 2024 at 19:58

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.