Right now I have a small database with two tables that look something like this:
users table
====================
id name status_id
1 Bo
You aren't JOINing here:
SELECT *
FROM Users U, Statuses S
WHERE S.id=U.status_ID
AND status_id = 2;
The easiest way would be through joins:
select *
from User u join Status s on u.status_id = s.id;
(if you dont want the status-id at all, you can specify the columns that you do want in the select-clause.)
Your users table does not have the value of approved in it. It is in your statuses table. When you request status_id you are going to get that value back from that query. You have to do a JOIN ON status_id
to make this work out I think. Or do a second query.
SELECT u.*, s.*
FROM users u
inner join statuses s on u.status_id = s.id
WHERE u.status_id = 2
What you need is this
SELECT *
FROM `users`
JOIN statuses ON statuses.id = users.status_id
WHERE `status_id` = 2";
and then you can refer to
$row['value'];