[eluser]jk215[/eluser]
Before installing Ion Auth I had a users table and listing table. I joined the two so it would display the posts author under it. I installed Ion Auth, remade the users table, and now trying the exact same code and cant get it to work. Any help is appreciated!
It is displaying the posts title, url, and date properly. But says the $username is undefined. I know this has to be from an error on joining the tables. Here is the error"
A PHP Error was encountered
Severity: Notice
Message: Undefined property: stdClass::$username
Filename: listings/index.php
Line Number: 6
Model:
Code:
public function get_all_entries()
{
$this->db->select('*');
$this->db->from('listings');
$this->db->join('users','users.id = listings.listing_by');
$query = $this->db->get();
if ($query->num_rows() > 0)
{
return $query->result();
}
else
{
return array();
}
}
View:
Code:
<?php foreach ($query as $entry) { ?>
<div class="blog_entry">
<h2><a >listing_url; ?>"><?php echo $entry->listing_title; ?></a></h2>
<span class="metadata">posted by <?php echo $entry->username; ?> <?php echo timespan($entry->listing_date); ?> ago.</span>
</div><br /><br />
<?php } ?>