I'm trying to add a description to a coded value on PHP. The code was extracted from a table, and the description from another. The idea is that they are presented on a table with the proper description for each code, but when I tried to add the raw ordered query, the descriptions where misplaced, so I tried this:
<table>
for($i=0; $i < $items; $i++)
{
$row = $results -> fetch_array();
echo '<tr>';
echo '<td>'.$row['code'].'</td>';
for($j=0; $j<$items2; $j++)
{
$row2 = $result2 -> fetch_array();
if ($row['code'] == $row2['code'])
{
echo '<td>'.$row2['description'].'</td>';
}
}
echo '</tr>';
}
echo '</table>';
It's working for the first value, but only that one, the rest of the column is empty.