Jump to content

order query by array?


BigTime

Recommended Posts

I need to order returned data by a certain column but not in a DEC or ASC order

 

Is it possible to do this via an array?

 

//the order you want to sort in an array 
$sortArray = array(Heavyweight,Lightweight,Middleweight,Featherweight,Bantamweight); 
//turn that array into a string for use in the query. 
$sortString = implode(',', $sortArray); 

 

How do I implement this array into the ORBER BY clause???  Is it possible?  If one of the entries in my array does not exist in the database will I get an error?

Link to comment
Share on other sites

Uhhhh....huh?  Im not double posting!?!  WTF!  Just feel like throwing something spicy out there randomly?

 

Looking back at the posts I see that you didn't double post, my mistake  :'(

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.