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
$email = new sendEmail;
and i don't know what the problem is
CodePudding user response:
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 i
th 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
.