If I place the echo "h"; inside the if statement I get nothing returned. Also if I place a WHERE clause inside the SQL code and use that method, I also get nothing returned inside the foreach loop. Any ideas as to why this is happening? I only need the user that matches the current user logged in. And what the script's doing is looping through all the rows in the users table
public function dcr() {
// pass all dashboard accesses through this function
$username = $this->session->userdata("username");
$query = $this->db->query("SELECT * FROM users");
foreach ($query->result() as $row) {
echo "h";
if ($username == $row->username) {
$data = array('firstname' => $row->firstname);
$this->load->view('dashboard', $data);
}
}
}