I'm trying to do something and I'm sure if I'm doing it in a right way. Let's say I have two tables in MySQL database with the following columns
-------------------------
Members
-------------------------
id name status
----- ----- -----
1 Mike 0
2 Alex 0
3 John 1
4 Jack -1
-------------------------
Status
-------------------------
id text
----- -----
-1 disapproved
0 reviewing
1 approved
Now I need to display the information of the table "Members" in the following way:
id name status
----- ----- -----
1 Mike reviewing
2 Alex reviewing
3 John approved
4 Jack disapproved
One way is to use an Inner Join between the two tables and the other way is to extract data from the "Members" table and put it inside a for-each loop and convert status values. In the latter way I don't need the "status" table at all.
I'm not sure which way is better. please let me know if you need more information to help me.
Thanks in advance.
Update
An for-each example for what I want to do is like this, supposing I have extracted data from "Memberes" table
foreach($data as $value)
{
if ($value['status'] == 0)
$value['status'] = 'reviewing';
if ($value['status'] == 1)
$value['status'] = 'approved';
else
$value['status'] = 'diapproved';
}