Re: Basic Dual Query Combine into one question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux