• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Filter Select List DB query by logged in user id

Filter Select List DB query by logged in user id 12 years 4 months ago #20746

I have a need to filter a db query by the id of the logged in user.

Not to certain how to accomplish this.

Ive tried the following but it only echo's out the user ID.
 
$rsuser=JFactory::getUser();
$user=$rsuser->get('id');
$items = "|Please Select[c]\n"; 
$db =& JFactory::getDBO(); 
$db->setQuery
("
SELECT #__nbill_entity.id, #__nbill_entity.company_name
FROM #__nbill_entity
JOIN #__nbill_entity_contact ON #__nbill_entity.id = #__nbill_entity_contact.entity_id
JOIN #__nbill_contact ON #__nbill_entity_contact.contact_id = #__nbill_contact.id
AND #__nbill_contact.user_id = $rsuser
");
 
$result = $db->loadObjectList(); 
 
foreach ($result as $r) 
      $items .= $r->#__nbill_entity.id . '|' . $r-> . $r->#__nbill_entity.company_name . "\n"; 

return $items;
 

Set alone either item works as expectd. Is there a correct way to do this? Am i even close.

Thanks in advace
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!