NEED Advice. Site search with results by date

mikeyd8
Posts: 7
Joined: 2012-08-22 23:24

NEED Advice. Site search with results by date

Post by mikeyd8 » 2013-08-08 20:34

I have a site, mysql 5, php 5. Data in tables with date fields. Here's the thing...

I need to site search but results must be in date descending order. I see lots of scripts around, but all seem to give results by relevance. I used phpdig with some success, but couldn't get results by date.

Used Interakt site search, and that was great, but again, couldn't get results by date.

Any ideas will be greatly appreciated.

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: NEED Advice. Site search with results by date

Post by Fred » 2013-08-11 09:26

Here is what you do
In the "Additional Sql condition field add something like this

Code: Select all

record_id >= 0 ORDER BY  some_date DESC
Note:
The additional condition is something following the "WHERE" part of the statement so you cant just add the "ORDER BY", you will get an error.
You need to satisfy the "WHERE" part of the statement first then you can add the usual stuff after that.

bapa
Posts: 3
Joined: 2013-09-13 13:27

Re: NEED Advice. Site search with results by date

Post by bapa » 2013-09-16 11:16

Hi

I found that INTERAKT lists display date data in char order, so I created an extra field in my SQL in YYYYMMDD format - and display that in the list. That enables you sort and display the data correctly (but the filter is trickier).

B

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: NEED Advice. Site search with results by date

Post by Fred » 2013-09-19 19:48

bapa wrote:Hi

I found that INTERAKT lists display date data in char order, so I created an extra field in my SQL in YYYYMMDD format - and display that in the list. That enables you sort and display the data correctly (but the filter is trickier).

B
So how is this going to help you sort the results in this instance? You will still need to add the "additional sql" for the "site search" SB like I suggested in my last response.
Or am I missing something?

Post Reply