I have 2 database tables that looks like this
Subscriptions table
member_id active
5 1
7 0
8 1
Plans Table
member_id disk
5 2000
7 5000
8 3000
Ii want to show disk for the currently logged in user where active = 1. So if currently logged in user is has member_id 8 and his active = 1 we will show 3000. We get the currently logged in user by doing $this->EE->session->userdata('member_id')
I have the following SELECT statement, but it’s not working. it’s throwing 500 internal server error. do you see anything wrong with it.
$results = $this->EE->db->query("SELECT disk FROM exp_membrr_plans p JOIN exp_membrr_subscriptions s ON p.member_id = s.member_id WHERE p.member_id = $this->EE->session->userdata('member_id') AND s.active=1 LIMIT 1");
$results->row('p.disk'); // the problem seems to be here. If i comment out this line i get no error
Change it into something like this: