I have these two functions:
public function desplubicarItem(){
$item_id = JRequest::getCMD('id');
$app = JFactory::getApplication();
$db = JFactory::getDbo();
$query = 'UPDATE #__k2_items SET published=0 WHERE id='.$item_id;
$db->setQuery($query);
$db->query();
}
public function getCuponesUtilizados(){
$db = JFactory::getDbo();
$query = 'SELECT count(item_id) as contador
FROM #__cuphoneo_subscripcion as cs
LEFT JOIN #__k2_items as k2i ON k2i.id = cs.item_id
WHERE cs.estado=0 AND k2i.id='..' GROUP BY cs.item_id';
$db->setQuery($query);
$resultado = $db->loadObject();
return $resultado;
}
I want to use the variable $item_id in the first function inside the second function. How can I do this?