php - Query table, but get a specific id listed first -


i have table in database, named "folders".

how make query output list specific id first?

lets use id "12345" folder want listed first.

i use this:

mysql_query("select id, name folders memberid='$session_userid' order name asc ") or die(mysql_error()); 

i tried google it, nothing comes , i'm totally blank :(

you need add order by clause special criteria. expression give 1 value "preferred" record , second value other records work.

mysql_query("select id, name folders     memberid='$session_userid'     order if(id=12345, 1, 2), name asc") or die(mysql_error()); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -