如何使用URL标识一个页面的其他页面的url ID where子句 像 我有送http://localhost/Eshopper/products.php?id=1 其中ID是产品就像在我的表,我有tbl_products 在如何使用WHERE子句动态
的product_id,produc_name,brand_id
在品牌选择表格菜单临客我对三星的菜单,当我们点击它会显示所有三星手机 我有使用其中的查询获取数据我能得到的数据通过传递手动编号,如
SELECT * FROM tbl_products
WHERE brand_id = 1 ,但我想从URL这个品牌ID = 1,我通过 http://localhost/Eshopper/products.php?id=1 此编号1 automacticlly加入到其中condtion传递所以要做到这一点
你可以亲切你的问题,并使其可读? –
$ _GET ['id']将保存来自url的id值。 – Santy
查询后,添加此行。 'if(isset($ _ GET ['id'])){ $ query。=“WHERE product_id ='”。 (int)$ _GET ['id']。 “'”; }' –