我有一个由此查询填充的下拉列表:
$sql = "SELECT DISTINCT CAST(MR_ID AS INT) AS MR_ID FROM Stage_Rebate_Index";
然后我有一个表,它会根据下拉列表的选择在表中显示值。我用这个查询来做到这一点。一切正常!
$sql_one = "SELECT CAST(Supp_ID AS INT) AS Supp_ID, CAST(MR_ID AS INT) AS MR_ID FROM Stage_Rebate_Index WHERE MR_ID = '$mr_id'";
但是,我必须进行一些更改,这是我需要填充下拉列表的查询。
$sql = "SELECT DISTINCT ID_Name, MR_ID as sort_column FROM Stage_Rebate_Index ORDER BY sort_column";
这是我用来根据下拉列表的选择在表格中显示值的查询。但是,现在它无论如何都无法运作。无论何时进行选择,唯一显示的是表头。我已经发现它的ID_Name列是一个varchar,而所有其他列都是Float数据类型。反正这样可以解决varchar数据类型吗?
$sql_one = "
SELECT ID_Name, CAST(Supp_ID as INT) as Supp_ID
FROM Stage_Rebate_Index
WHERE ID_Name = '$mr_id'";