how to get row field for each node i created a field called : (sitename_ar) and i have two rows (two domains) in  {domain} field :

and i have in my database these two fields {node} and {domain_access} :


and i want display in view page:
node : Title
node : Domain (sitename_ar)
i have created a view and i added a Title field and a Global:php field to call rows from database :

and i addedd those lines :

but always it display the same field (the first row) :

How i can Join all those 3 fields and display for each node her domain (with sitename_ar)
The error is in your php snippet. You request all rows, but $query-&gt;fetchObject(); only returns the first one, as you do not iterate over them.
Use something like $query-&gt;fetchAll() or $query-&gt;fetchAllAssoc('domain_id'); instead to access all rows.

But, I think there must be smarter ways to handle this. Can't you add a relationship from the node to the domain? (I never used domain before). Such relationship would give you the domain entity associated with the node, so you always have the right one.