• 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: Default value from database

Default value from database 11 years 3 months ago #26338

  • shop3
  • shop3's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 1
The example given didn't work for me so I removed the weird quotes in the example and it now works:

//<code>
$user = JFactory::getUser();
$db = JFactory::getDbo();
$userId = $user->get('id');

// Is the user logged in?
if ($userId) {
// Grab the value from the database.
$db->setQuery("SELECT phone FROM #__comprofiler WHERE user_id=".$userId);
return $db->loadResult();
}
//</code>
The administrator has disabled public write access.
The following user(s) said Thank You: jon380

Default value from database 11 years 1 month ago #27090

Hi, I have something very close to what you're doing, but cannot get it to work. You say you've removed weird quotes, but where you've got:

... WHERE user_id=".$userId);

it doesn't look like the syntax is quite right.

I'm trying:

//<code>

$user = JFactory::getUser();
$userid = $user->get('id');

$db = JFactory::getDbo();
$db->setQuery("SELECT cf_org FROM #__extendedreg_users WHERE user_id = .$userid. ");
$value = $db->loadResult();
return $value;

//</code>
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!