Extract a single value from array()

More
5 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 :)
$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.

More
5 years 7 months ago #12028 by solidres
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 Log in or Create an account to join the conversation.

More
5 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... :p

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
Powered by Kunena Forum

All the things you need to make your work easier. Did you like Solidres?