Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Attempt to read property when calling a class

i am getting this error when i call my phpMailer class

Warning: Attempt to read property "email" on array in C:\xampp\htdocs\WiShop\core\controllers\admin.php on line 254

and this is my line 254

                $result = $email -> send_email_admin_cancel_order($client_info[0] -> full_name, $client_info -> email, $_GET['code']);

and this is class call on line 253

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

                $email = new sendEmail;

and i don’t know what the problem is

>Solution :

You’re attempting to use -> syntax on an array; this only works on objects.

$client_info is currently an array not an object. I assume this only happens with the email property and not full_name because you are not taking the ith item when accessing email, e.g.

$client_info[0]->full_name
$client_info->email
Based on context you need to change the second line to $client_info[0]->email.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading