Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-05-22 10:26:28

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

mysql order by field [sort="field()"] with strings

Is it possible to use the mysql order by field for sorting with strings (not numbers)?

I’ve given this a try but fail because TXP escapes the quotes:

<txp:article sort="field(custom_1,'this','that','other') desc, Posted asc"

Offline

#2 2008-05-22 10:46:40

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: mysql order by field [sort="field()"] with strings

It’s not possible, unless you write PHP code and perform the query manually.

Offline

#3 2008-05-22 12:44:18

wolfcry911
Member
From: MA, USA
Registered: 2006-06-30
Posts: 51

Re: mysql order by field [sort="field()"] with strings

Okay, thank you.

I’m guessing this would be true with any strings, so a case when then statement wouldn’t work either.

Offline

#4 2008-05-22 12:58:27

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: mysql order by field [sort="field()"] with strings

Have you read this? I think it could help you

Offline

Board footer

Powered by FluxBB