Welcome Guest, Not a member yet? Register   Sign In
Trying to get property of non-object

(08-28-2016, 06:29 PM)davy_yg Wrote: Hello,

I am facing another error message here:

A PHP Error was encountered

Severity: Notice

Message:  Trying to get property of non-object

Filename:  views/pcategories.php

Line Number: 58


File: C:\Program Files\EasyPHP\www\CompanyGiondaCI\application\views\pcategories.php

Line: 58

Function: _error_handler';">EDIT



PHP Code:
<?php foreach ($posts as $post): ?>
 <td><?php echo $post['ctgparent_name']; ?></td>
 <td><?php echo $post['ctgparent_description']; ?></td>
 <td><button type="button" class="edit" onclick="location.href='<?php echo site_url('cpages/editparentctg/'.$post->ctgp_no); ?>';">EDIT</button></td>
 <td><button type="button" class="delete" onclick="location.href='<?php echo site_url('cpages/editparentctg/'.$post->ctgp_no); ?>';">DELETE</button></td> 
 <?php endforeach; ?>

line 58: 

<td><button type="button" class="edit" onclick="location.href='<?php echo site_url('cpages/editparentctg/'.$post->ctgp_no); ?>';">EDIT</button></td>


PHP Code:
public function pcategories() { 
$data['posts'] = $this->Mpages->call_parentctg();

//$data['ctgparent_name'] = $this->Mpages->call_parentctg();
 //$data['ctgparent_description'] = "Second";//$this->Mpages->retrieve_parentctg();


PHP Code:
public function call_parentctg()
$query $this->db->get('menu_parent');

How to fix the error message?

 It is because you trying to return an array, not object. Use ->result() instead of ->result_array().

[Just a programmer] Cool [/Just a programmer]

Messages In This Thread
Trying to get property of non-object - by davy_yg - 08-28-2016, 06:29 PM
RE: Trying to get property of non-object - by Joel Catantan - 08-29-2016, 06:45 PM

Theme © iAndrew 2016 - Forum software by © MyBB