0

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?

learner
  • 4,614
  • 7
  • 54
  • 98
  • You can use this: http://stackoverflow.com/questions/20334355/how-to-get-protected-property-of-object-in-php but if the object is protected, it should not refer to it that way. – rad11 Jul 27 '16 at 05:45

1 Answers1

2

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

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

Taha Paksu
  • 15,371
  • 2
  • 44
  • 78