当前位置: 代码迷 >> PHP >> ,取值输出有关问题
  详细解决方案

,取值输出有关问题

热度:8   发布时间:2016-04-28 16:51:23.0
求助,取值输出问题
$idss = '3,2,7,5';
$re = $db->findall('select id,title from aaa where id in('.$idss.')');
foreach($re as $list){
   echo $list['id'].',';
}

输出结果是:2,3,5,7
怎么才能让它按照$idss的顺序输出:3,2,7,5, 呢?谢谢!

------解决思路----------------------
$re = $db->findall("select id,title from aaa where id in($idss) order by fiind_in_set(id, '$idsd')");

------解决思路----------------------

$re = $db->findall("select id,title from table where find_in_set(id, ".$idss.")");


试试。
  相关解决方案