mysql - PHP order by clause with array as order by statement -


i got array query

this array ordered criteria.

now want make new query

sample

$array = (987, 2661, 12, 789, 54); 

and want in order array selecting articles

select * article a.number (a.number in ($array)) 

how can realize result ordered $array ids?

thx 4 answer guys :)

edit :

article table: id, name etc..  property table:  id, article_id, name, value  1,        10,   journey_days, 2 2,        30,   journey_days, 1 3,        40,   journey_days, 5 1,        10,   stars,        2 2,        10,   stars,        4 3,        10,   stars,        0 4,        10,   stars,        1 

i join both tables, can see property have more 1 value per column 1 article.

i need join property table article table , values there related property table article, if make clause stars or journey_days.

how can realise this? select property.name values or on clause?

hope guys understand question

use implode:

$s = implode(",", $array); $q = "select * article a.number (a.number in ($s))"; 

Comments