0
votes

I have an exception object which looks like:

Exception Object ( [message:protected] => You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selectPROFILEID,SUBSCRIPTION,MOD_DT,ACTIVATED,INCOMPLETE from newjs.JPROFILE whe' at line 1 [string:Exception:private] => [code:protected] => 0 [file:protected] => /var/www/html/JsMain/web/commonFiles/mysql_multiple_connections.php [line:protected] => 92 [trace:Exception:private] => Array ( [0] => Array ( [file] => /var/www/html/JsMain/web/jsadmin/add_edit_fields.php [line] => 46 [function] => mysql_error_js [args] => Array ( ) ) ) [previous:Exception:private] => )

I want to access message in this object using .message and so on for other values.

 print_r(($Var.message));

It doesn't work at all. Please tell me how can I access?

1
You can use this: stackoverflow.com/questions/20334355/… but if the object is protected, it should not refer to it that way. - rad11

1 Answers

2
votes

Did you try $var->getMessage(); as it is an Exception object.

http://php.net/manual/en/class.exception.php