Re: Re: Basic Dual Query Combine into one question
| From: | Aziz Saleh | Date: | Thu, 05 Feb 2015 22:16:19 +0000 |
| Subject: | Re: Re: Basic Dual Query Combine into one question | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-324393@lists.php.net to get a copy of this message | ||
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).