Voting starts in March for the Drupal Association Board election.
I have a view with a few fields including 3 Global:PHP fields. I use first two PHP fields to return the counted result of votes by using some sql query, and use the third PHP field to sum up the first two. The output results of these three fields are displayed correctly in the preview, and I used print_r($data) to check and they did appear having correct value. But when I try to use Global:PHP to sort the result I failed.
My code in Sort code is:
return $row1->php_2 < $row2->php_2 ? -1 : (int)$row1->php_2 > $row2->php_2;
where php_2 is my third PHP field mentioned above.
I then put dsm($row1); before the above code. It turned out that 3 of my PHP fields have no value while the other fields have correct value. They appear to be: php(NULL) php_1(NULL) php_2(NULL). Any ideas?