How do I set ORDER BY params using prepared PDO statement?

后端 未结 8 2107
心在旅途
心在旅途 2020-11-22 15:37

I\'m having problems using params in the ORDER BY section of my SQL. It doesn\'t issue any warnings, but prints out nothing.

$order = \'column         


        
8条回答
  •  逝去的感伤
    2020-11-22 16:10

    It is possible . You can use number instead of field name in the 'order by' clause. This is a number starting from 1 and is in the order of field names in the query. And you can concatenate a string in for ASC or DESC. For example "Select col1,col2,col3 from tab1 order by ? " + strDesc + " limit 10,5". strDesc=" ASC" / " DESC".

提交回复
热议问题