[FX.php List] Search for records by date range
Chris Hansen
chris at iViking.org
Wed Sep 22 11:20:09 MDT 2004
Greetings!
For the sake of legibility it's often useful to specify which logical
operator should be used. That said, here's the relevant snippet from
the FM7 custom web publishing docs:
<manual_snippet>
–lop (Logical operator) query parameter
Specifies how the find criteria in the –find query command are combined
as either an “and” or an “or” search
Value is: "and" or "or" (which must be specified in lowercase). If the
–lop query parameter is not included, then the –find query command
uses the _and_ value.
</manual_snippet>
In other words, "and" is the default value (this is also stated in the
FX.php docs.) One thing of note that I found this morning, FileMaker 7
expects "and" or "or" to be lower case. I need to make sure that
FX.php addresses this, but in the mean time, if you specify a logical
operator with FM7SA, make sure it's in lower case.
Hope this clears up any confusion. Best,
--Chris Hansen
creator of FX.php
"The best way from FileMaker to the Web."
www.iViking.org
On Sep 22, 2004, at 1:13 AM, Log-Out wrote:
> Because the default Logical Operator in FM is "OR", I think you should
> add this:
>
> $query->AddDBParam("-lop", "AND");
> $query->AddDBParam("my_date", $_POST['from_date'], $op='gte');
> $query->AddDBParam("my_date",$_POST['to_date'], $op='lte');
>
> Log-Out
> Spain
>
> El 21/09/2004, a las 21:51, Dale Bengston escribió:
>
>> Well, the post variable names don't *have* to be the field names.
>>
>> Here's another approach. Not better or worse, but different:
>>
>> <input type="text" name="from_date">
>> <input type="text" name="to_date">
>>
>> $query->AddDBParam("my_date", $_POST['from_date'], $op='gte')
>> $query->AddDBParam("my_date",$_POST['to_date'], $op='lte')
>>
>> Dale
>>
>> On Sep 21, 2004, at 12:56 PM, Kim Hawksworth wrote:
>>
>>> Thank you! This is exactly what I need. I must get out of the mind
>>> set that only the field names can be passed as $_POST varialbles.
>>>
>>> Kim David Hawksworth, R.Ph., Web Manager
>>> The Ohio State University Medical Center
>>> Department of Pharmacy
>>>
>>>>>> log-out at yacobi.com 9/21/2004 10:36:38 AM >>>
>>> El 21/09/2004, a las 14:52, Kim Hawksworth escribió:
>>>
>>>> I have a database that I would like to be able to search by date
>>>> range.
>>>> I have a field in the database called "date" which auto-enters the
>>>> record's creation date. Under CDML I used the following code in an
>>>> html form to search records by date range:
>>>>
>>>>> From Date: <input type="hidden" name="-op" value="gte"><input
>>>> type="text" name="date" value="">
>>>> To Date: <input type="hidden" name="-op" value="lte"><input
>>>> type="text"
>>>> name="date" value="">
>>>>
>>>> Is there an easy way to do this with FX.php? If I use this same
>>>> code
>>>> with FX.php, it only returns records with the "To Date".
>>>
>>> I use:
>>>
>>> ///the form
>>> <form action="the_query.php" method="post" ...>
>>> <input type="text" name="from_date">
>>> <input <input type="text" name="to_date">
>>>
>>> ///the response file: the_query.php
>>>
>>> $query = new FX($serverIP, $serverPort);
>>> [...]
>>> $range_date = $_POST["from_date"]."...".$_POST["to_date"];
>>> $query->AddDBParam("date_field", $range_date)
>>> [..]
>>> $query->FMFind();
>>>
>>> Log-Out
>>> Spain
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>> _______________________________________________
>>> FX.php_List mailing list
>>> FX.php_List at mail.iviking.org
>>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>>
>>
>> _______________________________________________
>> FX.php_List mailing list
>> FX.php_List at mail.iviking.org
>> http://www.iviking.org/mailman/listinfo/fx.php_list
>>
>
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
More information about the FX.php_List
mailing list