• 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: extract database values inside custom field

extract database values inside custom field 9 years 5 months ago #33228

Hi,

I'm using the code to extract data from the database to show a matching email address. I want to use a WHERE statement to select the logged in user. But unfortunately I can not use {global:useremail} in this code. Is there a way to get the email address of the logged in user in the WHERE statement?

This is what doen not work:

//<code>
$db =& JFactory::getDBO();
$db->setQuery("SELECT emailcolleague FROM `field` WHERE user_email = '{global:useremail' ");
$result = $db->loadResult();
return $result;
//</code>

If I fill in an email address manually instead of global... it does work. But how to get it to be dependent of the logged in user?

Thanks.
The administrator has disabled public write access.

extract database values inside custom field 9 years 5 months ago #33280

  • alexp
  • alexp's Avatar
  • OFFLINE
  • RSJoomla! Official Staff
  • Posts: 2253
  • Thank you received: 180
Try this instead:
//<code>
$db =& JFactory::getDBO();
$user = JFactoryt::getUser();
$db->setQuery("SELECT emailcolleague FROM `field` WHERE user_email = '".$user->id."' ");
$result = $db->loadResult();
return $result;
//</code>
Please note: my help is not official customer support. To receive your support, submit a ticket by clicking here
Regards,
RSJoomla! Development Team
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!