[FX.php List] Search for records by date range

Log-Out log-out at yacobi.com
Wed Sep 22 01:13:11 MDT 2004


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
>



More information about the FX.php_List mailing list