Revolution10
Member
Dear all,
something that I cannot see and I hope it can be solved easily.
I have this query that doesn't work:
// If group is Delivery List, then query for the Address data
if ($group->title =='Delivery List'):
$IDinput = '{From_raw}';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select('address')
->from('package_location')
->where('id = ' . $db->getEscaped($IDinput));
echo $query;
$db->setQuery($query);
$fieldA = $db->loadResult();
echo $fieldA;
endif;
I echoed the query and it is correct.
SELECT address FROM package_location WHERE id = 3
If I change $IDinput value for a value inserted manually it works:
->where('id = ' . $db->getEscaped(3));
or
->where('id = 3' );
I thought then that was a format problem with the $IDinput value. So I tried to force it to INT:
$IDinput =(int) '{From}';
but it returned always 0:
SELECT address FROM package_location WHERE id = 0
By the way, From_raw is an join field. I tested with {rowID} (only to test) and the same problem...
So, I'm here blocked without knowing what to do...
Thank you very much for your help!
something that I cannot see and I hope it can be solved easily.
I have this query that doesn't work:
// If group is Delivery List, then query for the Address data
if ($group->title =='Delivery List'):
$IDinput = '{From_raw}';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select('address')
->from('package_location')
->where('id = ' . $db->getEscaped($IDinput));
echo $query;
$db->setQuery($query);
$fieldA = $db->loadResult();
echo $fieldA;
endif;
I echoed the query and it is correct.
SELECT address FROM package_location WHERE id = 3
If I change $IDinput value for a value inserted manually it works:
->where('id = ' . $db->getEscaped(3));
or
->where('id = 3' );
I thought then that was a format problem with the $IDinput value. So I tried to force it to INT:
$IDinput =(int) '{From}';
but it returned always 0:
SELECT address FROM package_location WHERE id = 0
By the way, From_raw is an join field. I tested with {rowID} (only to test) and the same problem...
So, I'm here blocked without knowing what to do...
Thank you very much for your help!