我如何知道选择了哪个 OR 语句?我希望 fetch 显示选择的 colour.col。
$parsed = array();
$result = mysql_query("SELECT *
FROM colour
LEFT JOIN shape ON colour.id = shape.id
WHERE shape.col1 = 'square' AND colour.col1 = 'blue'
OR shape.col1 = 'square' AND colour.col2 = 'pink'
OR shape.col1 = 'circle' AND colour.col3 = 'red'
OR shape.col1 = 'triangle' AND colour.col4 = 'yellow'
OR shape.col1 = 'rectangle' AND colour.col5 = 'green'
");
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row[col1] . "</td>";
**which colour column was selected?**
I would like to see the column header here (colour.col1,colour.col2...) not the value (pink,green...)
echo "</tr>";
}