I'm trying to figure out what I've got going on here thats not working - I'm using RsTicketsPro and I'm trying to pull a specific value from their custom fields section in the database. I reached out to their support and this is what they recommended:
$db = JFactory::getDBO();
$db->setQuery("SELECT `value` FROM #__rsticketspro_custom_fields_values WHERE `ticket_id`='".$item->id."' AND `custom_field_id`=7");
echo $db->loadResult();
Ok so I adjusted their code to pop this into place in a table to display this specific value:
<td align="center" class="rst_cell_assigned center">
<?php
$db = JFactory::getDBO();
$db->setQuery("SELECT 'value' FROM #__rsticketspro_custom_fields_values WHERE 'ticket_id'='".$item->id."' AND 'custom_field_id'=4");
echo $db->loadResult();
?>
</td>
I updated the custom field id value to match with the corresponding field I want to pull from my database, but when I view it on the front end, it just displays blank - no error message or anything.
Anybody spot anything I'm doing wrong?
EDIT: CURRENT CODE IM WORKING WITH
<?php
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select(`value`);
$query->from($db->quoteName('#__rsticketspro_custom_fields_values'));
$query->where($db->quoteName(`ticket_id`)." = ".$db->quote('".$item->id."' AND `custom_field_id`=4"));
$db->setQuery($query);
$result = $db->loadResult();
echo $query;
echo $db->getErrorMsg();
?>
note so this one now does not even load the page any longer, haha. #fail