Re: Basic Dual Query Combine into one question
| From: | dealTek | Date: | Thu, 05 Feb 2015 23:45:11 +0000 |
| Subject: | Re: Basic Dual Query Combine into one question | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324394@lists.php.net to get a copy of this message | ||
On Feb 5, 2015, at 2:16 PM, Aziz Saleh <azizsaleh@gmail.com> wrote:
>
>
> On Thu, Feb 5, 2015 at 5:10 PM, dealTek <dealtek@gmail.com> wrote:
> Hi,
>
> Thanks for all the help - now I am up and running with sorting the filemaker query results!
>
> regular text is sorting well - however the "Test_Date" field sorts with no errors but
> as text not a date (comes in from filemaker as ex: "1/25/2015" etc.)
>
>
> this = no errors but just does TEXT sort
>
> $a->getField('Test_Date'),
> $b->getField('Test_Date')
>
>
> I tried this = shows errors and fails (from filemaker query)
>
> $a->strtotime(getField('Test_Date')),
> $b->strtotime(getField('Test_Date'))
>
> error....
> Fatal error: Call to undefined method FileMaker_Record::strtotime() in /xxxx.php on line 292
>
>
> BTW: i even tried this just to see and it still has same error...
>
> $a->strtotime('12/12/2012'),
> $b->strtotime('12/12/2012')
>
> ALSO strtotime() works fine later in the display loop = <?php echo
> strtotime($tests_row->getField('Test_Date',0)); ?>
>
>
>
>
> ???? Q: Is there a better way to script this sort this field as a DATE not TEXT?
>
>
> -------------------
>
> <?php
> $records = $tests_result->getRecords();
> // 2 field sort
>
> function cmp($a, $b)
> {
> $result = strcmp(
>
> // !!!!!! errors ???? how do I fix?
> $a->strtotime(getField('Test_Date')),
> $b->strtotime(getField('Test_Date'))
> );
> // indifferent, i.e. last names are identical, so sort by state
>
> if (!$result) {
> $result = strcmp(
> $a->getField('last'),
> $b->getField('last')
> );
> }
>
> /* */
> return $result;
> }
> usort($tests_result->getRecords(), "cmp");
> ?>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
> You are attempting to access a method 'strototime' in the FileMaker_Record scope
> which doesn't exist. strtotime != FileMaker_Record->strtotime (one is a function the other
> is a method of an object).
Hi,
Thanks for the help...
makes sense... but I am a newbie with this...
can you tell me a way to modify the usort script to get it to work?
...
like maybe a way to set the --- getField('Test_Date') to a strtotime($datevar ????) before
the next lines or something like that?
instead of ...
> $a->strtotime(getField('Test_Date')),
> $b->strtotime(getField('Test_Date'))
>
$datevar = strtotime(getField('Test_Date')) ????
then
>
> $a->strtotime(datevar),
> $b->strtotime(datevar)
>
or what is better to do ????
I tried a few things but they still had errors.......
THANKS IN ADVANCE
DAVE
--
Thanks,
Dave - DealTek
dealtek@gmail.com
[db-15]