By LR on
Hi,
I have created a content-type "customer" with a custom field "phone_number".
I retrieve all my customers like this:
$query = db_select( 'node', 'n' );
$query
->condition( 'type', 'customer' )
->fields( 'n' );
$result = $query->execute();
$customers = array();
foreach( $result as $row ) {
$customers[ $row->nid ] = $row;
}But when I do print_r( $customers ), I cannot see any "phone_number". Why?
What is the proper way to get the phone numbers of my customers?
Regards
Comments
Try this
When you query the database,
When you query the database, you are not getting back full nodes, just the data you queried for. You still have to load the full node to access it's fields. I'd try something like this:
- Brendan
That works, thank you very
That works, thank you very much