- Posts: 290
- Home
- Forum
- Community Forum
- Questions
- translation in filter and navigation bar
Extract a single value from array()
- Thellie
- Topic Author
- Offline
Less
More
6 years 7 months ago #12026
by Thellie
Extract a single value from array() was created by Thellie
Hi 
I'm trying to extract some data from the summary field (#_sr_experience_reservations). I've never done this before, and have got as far as I can...
I can extract the array with all the values, but can't work out the syntax to just get one value (subTotal)... Could you please, if it's easy, show me where I've gone wrong? Thanks

I'm trying to extract some data from the summary field (#_sr_experience_reservations). I've never done this before, and have got as far as I can...
I can extract the array with all the values, but can't work out the syntax to just get one value (subTotal)... Could you please, if it's easy, show me where I've gone wrong? Thanks

$resid = '{group_members___reservation_id}';
$myDb = JFactory::getDbo();
$myQuery = $myDb->getQuery(true);
$myQuery
->select('summary')
->from('test_sr_experience_reservations')
->where('id = ' . $resid);
$myDb->setQuery($myQuery);
$rows = $myDb->loadObjectList();
$list = array();
foreach ($rows as $row)
{
$list[subTotal] = $row->summary;
}
return implode($list);
Please Log in or Create an account to join the conversation.
- solidres
-
- Offline
Less
More
- Posts: 2953
6 years 7 months ago #12028
by solidres
FAQ: www.solidres.com/support/frequently-asked-questions
Support Policy: www.solidres.com/support-policy
Replied by solidres on topic Extract a single value from array()
Hi,
Please check it file, it'd be helpful for you:
/plugins/solidres/experience/administrator/components/com_solidres/models/expreservation.php => getItem()
Regards,
Please check it file, it'd be helpful for you:
/plugins/solidres/experience/administrator/components/com_solidres/models/expreservation.php => getItem()
Regards,
FAQ: www.solidres.com/support/frequently-asked-questions
Support Policy: www.solidres.com/support-policy
Please Log in or Create an account to join the conversation.
- Thellie
- Topic Author
- Offline
Less
More
- Posts: 290
6 years 7 months ago #12029
by Thellie
Replied by Thellie on topic Extract a single value from array()
Ah, that's more PHP knowledge than I have... I can't work out if I have to write a function, use a piece of code, or something else... 
Never mind, I'll think of another approach to do what I need.

Never mind, I'll think of another approach to do what I need.
Please Log in or Create an account to join the conversation.
Moderators: solidres