Original SQL statement:
$sql=$empire->query("select classid,sonclass,classname,islast,islist from {$dbtbpre}enewsclass where classid in (1,22,239,241,75,80,45,62) and showclass=0 order by myorder,myorder asc");Modified SQL statement:
$sql = $empire->query("
SELECT
classid,
sonclass,
classname,
islast,
islist
FROM
{$dbtbpre}enewsclass
WHERE
classid IN (1,22,239,241,75,80,45,62)
AND showclass=0
ORDER BY
FIELD(classid, 1, 22, 239, 241, 75, 80, 45, 62),
myorder ASC
");In an SQL query, if you want to filter results based onclassid在INTo sort the elements in a clause by their order, you need to create a custom sorting logic.
For example, useCASEUse a statement to manually define a sorting rule.