I have a database like this
|| ID - COL1 - COL2||
|| 1 - row1A - 1 ||
|| 2 - row1A - 1 ||
|| 3 - row1A - 2 ||
|| 4 - row1B - 2 ||
|| 5 - row1A - 3 ||
|| 6 - row1B - 3 ||
i want to ECHO
these data like this
$query = "SELECT * FROM DB WHERE COL1 = 'row1A'";
while($row = $stmt->fetch()){
$col = $row['COL1'];
echo "
<div>Set1: $col</div> // = row1A, row1A as where COL2 = 1
<div>Set2: $col</div> // = row1A as where COL2 = 2
<div>Set3: $col</div> // = row1A as where COL2 = 3
";
}
I'm using this with a relation between 3 tables so each row1A will has its own name in different table, But right now i want to know how can i call the database ordered by COL2
For each SetN
gets the value of COL1 WHERE COL2
= N