0

I have a float field, and I just want to print this field in a PHP field. I am using this code.

print $row->title; // It prints the same value.
print $row->field_pa_total; // It prints the wrong value; the field value is 5000, but the printed value is 40.

How do I print the field value?

1
  • 1
    Please specify what Drupal and Views versions you are using.
    – Alex Weber
    Apr 15, 2012 at 3:46

1 Answer 1

2

print_r($row); should give you the structure of the row and tell you the names of the various fields and values etc.

2
  • Just complementing for the OPs benefit, the object attribute is named more like the schema, so it would be $row->field_pa_total_value or $row->field_pa_total['und'][0]['value'] or something like that
    – Alex Weber
    Apr 15, 2012 at 3:48
  • i tried print_r($row) the result is: stdClass Object ( [title] => 1 [title_1] => ???? [field_pi_lastname] => 146 [field_pi_father] => 146 [field_bt_address] => 148 [field_bt_work] => 148 [field_bt_hospital] => 148 [field_bt_money] => 148 [field_bt_active] => 148 [field_bt_total] => 148 [field_pa_total] => 151 [php] => [expression] => ) Apr 15, 2012 at 3:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.