1

I want to display value from fetched array from database I want to display only field_data_field_videoicon_node_entity_type

global $user;
$uid = $user->uid;
$result = db_query("SELECT node.title AS node_title, node.nid AS nid,  node.created AS node_created,  'node' AS field_data_field_videoicon_node_entity_type, 'node' AS field_data_field_customername_node_entity_type
FROM {node} node LEFT JOIN {field_data_field_customervideo} field_data_field_customervideo ON node.nid = field_data_field_customervideo.entity_id AND field_data_field_customervideo.entity_type = 'node' WHERE (( (node.status = 1 OR (node.uid = 1 AND 1 <> 0 AND 1 = 1) OR 1 = 1) AND (node.type IN  ('customerspeach')) )) ORDER BY node_created DESC LIMIT 3 OFFSET 0")->fetchAll(); 
// Printing result.
print_r($result);

$result returns

Array ( 
    [0] => stdClass Object ( 
        [node_title] => client speach 2 
        [nid] => 65 
        [node_created] => 1473758768 
        [field_data_field_videoicon_node_entity_type] => node
        [field_data_field_customername_node_entity_type] => node 
    ) 
    [1] => stdClass Object ( 
        [node_title] => Customer Speak 
        [nid] => 62
        [node_created] => 1472720228
        [field_data_field_videoicon_node_entity_type] => node
        [field_data_field_customername_node_entity_type] => node 
    ) 
)
1
  • 1
    try iterating over the array of results, You have an array of objects. foreach($results as $result){ echo $result->field_data_field_videoicon_node_entity_type; } Commented Sep 14, 2016 at 6:02

1 Answer 1

1

This is object array. You can retrieve data by using -> arrow sign.

foreach($result as $data){
    echo $data -> field_data_field_videoicon_node_entity_type;
} 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.