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->from($db->quoteName('#__vinylvault_artists'));
$albumartistidquery->lookup($db->quoteName('artist_name'));
$albumartistidquery->where($db->quoteName('artist_id') . ' LIKE '. $db->quote($releaseartistid));

$db->setQuery($albumartistidquery);

// 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




PHP function with JDatabase queries

Updated September 08, 2016 08:06 AM

Ordering a UNION

Updated April 21, 2015 00:04 AM

Transforming a Query for JDATABASE

Updated July 28, 2015 14:04 PM