Home  >  Article  >  Backend Development  >  ,取值输出有关问题

,取值输出有关问题

WBOY
WBOYOriginal
2016-06-13 12:26:38830browse

求助,取值输出问题

$idss = '3,2,7,5';<br />$re = $db->findall('select id,title from aaa where id in('.$idss.')');<br />foreach($re as $list){<br />   echo $list['id'].',';<br />}

输出结果是: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')");

------解决思路----------------------
<br />$re = $db->findall("select id,title from table where find_in_set(id, ".$idss.")");<br />


试试。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn