seach by days created

6 posts by 2 authors in: Forums > CMS Builder
Last Post: March 7, 2011   (RSS)

By 4cdg - March 3, 2011

Need to search section by number of days a record has been in the system.

kind of like a days on the market real estate search.

can i use createdDate or updateDate for that and how would i set up the search

Re: [4cdg] seach by days created

By Jason - March 3, 2011

Hi,

You could use either of those fields. The one you would choose would depend on exactly what type of results you're trying to return. Could you give an example of the type of search you would like to do?

Thanks
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [4cdg] seach by days created

By Jason - March 7, 2011

Hi,

In order to do this, you'll have to create custom "WHERE" clauses to do the search. You can use a MySQL function called DATE_SUB to get a date in the past

For example, if you wanted to get all records that are 14 days old, you could use something like this:

'where' => "createdDate = DATE_SUB(createdDate, 14 DAY)",

Hope this helps get you started.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] seach by days created

By 4cdg - March 7, 2011

I wanted to make a form with a list so someone could choose how many days.

I don't think that is what this is

Re: [4cdg] seach by days created

By Jason - March 7, 2011

Hi,

A good place to start would be to see if you can get the query working with hard coded values. Once you have that working, you can create your list and replace the hard coded value with a value submitted by your form.

Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/