I'm face a new Problem in Codeigniter Framework. Her is my Out put
Array
(
[id] => 2
[firstname] => Maruf
[lastname] => Ifftekhar
[slug] =>
[email] => [email protected]
[email_subscribe] => 1
[self] =>
[phone] => 01767820010
[company] => Russel Host
[default_billing_address] =>
[default_shipping_address] =>
[ship_to_bill_address] => true
[password] => 0689d59aa30bdca7207db3d449255650
[active] => 1
[group_id] => 1
[confirmed] => 0
[group_discount_formula] => - 0
[expire] => 1380390903
)
A PHP Error was encountered
Severity: Notice
Message: Trying to get property of non-object
Filename: controllers/secure.php
Line Number: 46
abida Sultana
Here is Controller
`$`email = `$`this->input->post('email');
`$`password = `$`this->input->post('password');
`$`remember = `$`this->input->post('remember');
`$`redirect = `$`this->input->post('redirect');
`$`login = `$`this->Customer_model->login(`$`email, `$`password, `$`remember);
echo '/pre>-----';
print_r(`$`login);
echo 'abida Sultana'.`$`login->last_name; --------------------Line Number: 46
exit();
and Model is
function login(`$`email, `$`password, `$`remember = false) {
`$`this->db->select('*');
`$`this->db->where('email', `$`email);
`$`this->db->where('active', 1);
`$`this->db->where('password', md5(`$`password));
`$`this->db->limit(1);
`$`result = `$`this->db->get('customers');
`$`customer = `$`result->row_array();
if (`$`customer) {
// Retrieve customer addresses
`$`this->db->where(array('customer_id' => `$`customer['id'], 'id' => `$`customer['default_billing_address']));
`$`address = `$`this->db->get('customers_address_bank')->row_array();
if (`$`address) {
$fields = unserialize($address['field_data']);
$customer['bill_address'] = $fields;
$customer['bill_address']['id'] = $address['id']; // save the addres id for future reference
}
$this->db->where(array('customer_id' => $customer['id'], 'id' => $customer['default_shipping_address']));
$address = $this->db->get('customers_address_bank')->row_array();
if ($address) {
$fields = unserialize($address['field_data']);
$customer['ship_address'] = $fields;
$customer['ship_address']['id'] = $address['id'];
} else {
$customer['ship_to_bill_address'] = 'true';
}
// Set up any group discount
if ($customer['group_id'] != 0) {
$group = $this->get_group($customer['group_id']);
if ($group) { // group might not exist
if ($group->discount_type == "fixed") {
$customer['group_discount_formula'] = "- " . $group->discount;
} else {
$percent = (100 - (float) $group->discount) / 100;
$customer['group_discount_formula'] = '* (' . $percent . ')';
}
}
}
if (!$remember) {
$customer['expire'] = time() + $this->session_expire;
} else {
$customer['expire'] = false;
}
// put our customer in the cart
$this->go_cart->save_customer($customer);
return $customer;
} else {
return false;
}
}
$email should be $email.