我有一个声明,其中显示了特定范围内的项目的详细信息。所有细节都应该是这样的。
id | color | shape | material |
----------------------------
i45 | blue | square | plastic |
i46 | blue | square | plastic |
i47 | blue | square | plastic |
但如果范围没有像这样正确定义:
id | color | shape | material |
----------------------------
i45 | blue | square | plastic |
i46 | blue | square | plastic |
i47 | blue | square | plastic |
i48 | red | square | plastic |
我需要查询以返回具有与其他值不同的值的列名。列名将显示在弹出窗口中。目前我有一个声明:
$chk = "SELECT DISTINCT
color,
shape,
material,
FROM $table
WHERE id BETWEEN $StartID AND $EndID";
$res = mysqli_query($con, $chk) or die (mysqli_error($con));
$r = mysqli_num_rows($res);
if ($r > 1)
<script language="JavaScript">alert ("Some fields have different data")</script>
这只发现是否有不同的值..但我对如何获取具有不同值的列名很感兴趣..请帮助..