Forums

DB Multi Record Loader where statement

takisd 12 Nov, 2012
Hello,

I'm trying to do something that I was sure it is simple, but...
I have a DB Multi Record Loader on submit event. I have also some date fields in the form for filtering the query by date. I want to query my records using these date fields like:
createdtime between <?php echo $form->data['input_datefrom']; ?> and
                    <?php echo $form->data['input_dateto']; ?>

With this in where statement I have empty results. But with this
createdtime between '2012-11-01' and
                    '2012-11-30'

I have the November data.
So the question is "how can I use the form fields in a where statement" after a user submiting the form?

Thank you in advance.
Takis
GreyHead 12 Nov, 2012
Hi Takis,

In the PHP example you've left out the quotes round the date strings so it should be more like this
`createdtime` BETWEEN '<?php echo $form->data['input_datefrom']; ?>' AND '<?php echo $form->data['input_dateto']; ?>'
but I think you can also use the curly brackets syntax there
`createdtime` BETWEEN '{input_datefrom}' AND '{input_dateto}'

Bob
takisd 12 Nov, 2012
Hi Bob,
Yes, this is the solution, I was missing the quote. The second solution with curly brackets dosn't work, I had already test it.

Thank you very much.
Takis
This topic is locked and no more replies can be posted.