Query not giving expected answer

by Rich Starkie   Last Updated April 30, 2018 10:10 AM

I'm having a problem with a query

I do have a database connection earlier in the script

$db = JFactory::getDbo();

Here's the Query code

$albumartistidquery = $db->getQuery(true);

$albumartistidquery->select($db->quoteName(array('artist_id', 'artist_name')));
$albumartistidquery->where($db->quoteName('artist_id') . ' LIKE '. $db->quote($releaseartistid));


// Load the results
$dbalbumartist = $db->loadResult();

I'm expecting that $dbalbumartist should contain the contents of the relevant 'artist_name' field but when I echo $dbalbumartist it displays the 'artist_id'

can anyone advise where I've gone wrong and how to fix?

Related Questions

Ordering a UNION

Updated April 21, 2015 00:04 AM

PHP function with JDatabase queries

Updated September 08, 2016 08:06 AM

Transforming a Query for JDATABASE

Updated July 28, 2015 14:04 PM