PHP try catch not working

I can connect to my database and I have checked the sql code but I get an network error 500. I commented out the try/catch and the page works.

any idea of what I can do to fix this problem

you can see my code:

include_once $_SERVER['DOCUMENT_ROOT'] . '/includes/'; include $_SERVER['DOCUMENT_ROOT']. '../custdb/';

try { $sql = 'SELECT typeid, type FROM types'; $result = $pdo->query($sql); } catch (PDOException $e) { $error = 'Error fetching Company Types: ' . $e->getMessage(); include 'error.html.php'; exit(); }

foreach ($result as $row) { $types[] = array( 'typeid' => $row['typeid'], 'type' => $row['type']



include 'types.html.php';



Howdy -- it sounds like you're seeing a PHP coding issue there, rather than a Virtualmin related problem.

I'm not quite sure what the cause of the issue there is, but if you like, you could try asking in the Forums, in the "General Discussion" area. It's possible someone there is more familiar with the issue you're seeing.

Be sure to include the exact error that you're receiving in $HOME/logs/error_log when that issue occurs.