The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
![]()
Gentlemen,
I am trying to use various parameters in an ORDER BY clause in a query, and I just came up with an issue I can't overpass. Suppose we have the followings: PHP Code:
PHP Code:
PHP Code:
Now, I am trying to sort on a field, which does not exist as a column in any of the tables, but is calculated as below: PHP Code:
Quote:
I tried escaping the plus sign using a \, I tried enclosing the variable in double quotes, and then use " . $orderby .", I tried whatever I could think of, but admitedly I am not good at this, so I end up asking for your help here. Any ideas? They will be greatly appreciated. Merry Christmas to all |
#2
|
||||
|
||||
![]()
I've added some php and code tags to your post to make it a little more readable. I'm going to bed now and will take a look in the morning if I get a chance
![]() Edit: Ok i see your error already, you have to define the calculated field within your first batch of SQL. So add this to the first part of the sql: Code:
(w.warned_time+wt.warn_maturity*24*60*60) AS calculated_field Code:
ORDER BY calculated_field DESC |
#3
|
|||
|
|||
![]() Quote:
Thanks a lot. I got it working now. Sorry I missed those php tags, I should have known better, but I was so frustrated when I posted that message. Again tnx and Rgds |
#4
|
||||
|
||||
![]()
No problem, good luck with whatever you're coding
![]() |
#5
|
|||
|
|||
![]() Quote:
Thanks for the tip Dean, sincerely appreciated. Happy New Year to you and yours. |
![]() |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|