I have a database with 2 tables, I have a primary key(item\_id) and a foreign key(color\_id) in the items table. I list the items out with the color as the title as below, 

**Item details**

//item\_id

//color\_id

//Details

**Colors**

//Color\_id

//color\_suffix

//Color\_details

I list these items out like 
Color Suffix(RE)
item details
item details
item details etc etc...

Color Suffix(RT)
Item details
item details

To do this i loop through the colors table and make an sql call each time it loops 

```
$query = "SELECT * FROM COLORS";
$result = mysqli_query($connection,$query);
while($data= fetch_array($result)){
    echo "<h2>{$data['color_suffix']}</h2>";
    $query2 = "SELECT ... FROM items WHERE color_id = {$data['color_id']}";
    $result2 = mysqli_query($connection,$query);
    while($item = fetch_array($result2)) {
        //List all items
    }
}

```

This is only kind of sudo code im just wondering if there is a more efficient way.
I've been reading up on SQL inner join, Would this be the method i should use ?

I've also read up on prepared statements, But ill be honest i do not really understand the syntax on either.

Should i be doing it like this ? or is it extremely inefficient ? Bear in mind there will be around 30 different colors then about 10 - 50 items each so that a lot of SQL calls. 

Could someone provide some very basic sudo code to help me understand how i would achieve this ?

Thank you in advance
Ryan