Welcome Guest, Not a member yet? Register   Sign In
Image upload problem
#9

[eluser]haris244808[/eluser]
[quote author="TheFuzzy0ne" date="1364027929"]Instead of:
Code:
$users = $this->users_model->select_user_by_id($user_id);
foreach ($users as $results) {
    $pic_name = $results->profile_pic; //here i get the old pictures name
}

You'd just do:
Code:
$user = $this->users_model->select_user_by_id($user_id);
$pic_name = $user->profile_pic; //here i get the old pictures name

If you don't know how to access the property of an object, you could do with brushing up on it. We're here to help with CodeIgniter, not to teach you PHP. There are lots of good decent PHP tutorials available online.

http://lmgtfy.com/?q=php+tutorial[/quote]

i know how to access the property od an object...and i tried that but i didnt work because i frogot to tell that i call
Code:
$this->users_model->select_user_by_id($user_id);
in other places too and i was passing the results to the view by;
Code:
$data['users_query'] = $this->users_model->select_user_by_id($user_id); $this->load->view('some_page', $data);

so now all those places show mee that i am : Trying to get property of non-object...it is probably because i am storing in an array variable...i tried to store in a variable but still doesnt work...

how to solve this too??


Messages In This Thread
Image upload problem - by El Forum - 03-21-2013, 09:27 PM
Image upload problem - by El Forum - 03-22-2013, 05:48 AM
Image upload problem - by El Forum - 03-22-2013, 06:31 AM
Image upload problem - by El Forum - 03-22-2013, 07:14 AM
Image upload problem - by El Forum - 03-22-2013, 12:37 PM
Image upload problem - by El Forum - 03-22-2013, 01:13 PM
Image upload problem - by El Forum - 03-22-2013, 03:42 PM
Image upload problem - by El Forum - 03-23-2013, 01:38 AM
Image upload problem - by El Forum - 03-23-2013, 03:00 AM
Image upload problem - by El Forum - 03-23-2013, 03:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB