gpt4 book ai didi

php - ORDER BY 和 WHERE mysql 和 php

转载 作者:太空宇宙 更新时间:2023-11-03 12:24:07 25 4
gpt4 key购买 nike

This code doesn't work when add order by with where.

$sel = "SELECT * FROM items ORDER BY 'item_no' WHERE mainitem_id=".$_GET['cate_id'] ;

最佳答案

$sel = "SELECT * FROM items 
WHERE mainitem_id='".$_GET['cate_id']."'
ORDER BY item_no";

但请注意,您的代码容易受到 SQL 注入(inject)攻击。也请解决该问题。参见 here

关于php - ORDER BY 和 WHERE mysql 和 php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18421646/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com