data returns an array .So replacing
$udetails->comp_person_name
with
$udetails['0']->comp_person_name
solved the issue
data returns an array .So replacing
$udetails->comp_person_name
with
$udetails['0']->comp_person_name
solved the issue