Welcome Guest, Not a member yet? Register   Sign In
string based custom ordering in active record
#4

[eluser]TheFuzzy0ne[/eluser]
If your database hasn't been normalised, then there's only so much you can do to compensate for the design flaws.

As I mentioned before, you can use a CASE statement in your SELECT query, and order by that.

Alternatively, just code your MySQL by hand instead of using the Active Record class.

However, I don't understand why you're using FIELD(), since that's not going to do what you want to anyway. What's wrong with:

Code:
$this->db->order_by('category', 'asc');

Perhaps if you post your table structure, we'd be able to get a better understanding of the problem.


Messages In This Thread
string based custom ordering in active record - by El Forum - 03-23-2013, 04:55 AM
string based custom ordering in active record - by El Forum - 03-23-2013, 06:33 AM
string based custom ordering in active record - by El Forum - 03-23-2013, 09:35 AM
string based custom ordering in active record - by El Forum - 03-23-2013, 10:02 AM
string based custom ordering in active record - by El Forum - 03-23-2013, 08:15 PM
string based custom ordering in active record - by El Forum - 03-24-2013, 04:11 AM
string based custom ordering in active record - by El Forum - 03-24-2013, 05:09 AM
string based custom ordering in active record - by El Forum - 03-24-2013, 07:09 AM
string based custom ordering in active record - by El Forum - 03-27-2013, 03:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB