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
https://forums.phpfreaks.com/topic/150443-order-query-by-array/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.